本文整理汇总了Python中corehq.apps.sms.models.CallLog.count_by_domain方法的典型用法代码示例。如果您正苦于以下问题:Python CallLog.count_by_domain方法的具体用法?Python CallLog.count_by_domain怎么用?Python CallLog.count_by_domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.sms.models.CallLog
的用法示例。
在下文中一共展示了CallLog.count_by_domain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_401_response
# 需要导入模块: from corehq.apps.sms.models import CallLog [as 别名]
# 或者: from corehq.apps.sms.models.CallLog import count_by_domain [as 别名]
def test_401_response(self):
start_count = CallLog.count_by_domain(self.domain)
response = Client().post('/twilio/ivr/xxxxx', {
'From': self.phone_number,
'CallSid': 'xyz',
})
self.assertEqual(response.status_code, 401)
end_count = CallLog.count_by_domain(self.domain)
self.assertEqual(start_count, end_count)
示例2: test_log_call
# 需要导入模块: from corehq.apps.sms.models import CallLog [as 别名]
# 或者: from corehq.apps.sms.models.CallLog import count_by_domain [as 别名]
def test_log_call(self):
if self.__class__ == LogCallTestCase:
# The test runner picks up this base class too, but we only
# want to run the test on subclasses.
return
self.assertEqual(CallLog.count_by_domain(self.domain), 0)
response = self.simulate_inbound_call(self.phone_number)
self.check_response(response)
self.assertEqual(CallLog.count_by_domain(self.domain), 1)
call = CallLog.by_domain_asc(self.domain).all()[0]
self.assertEqual(call.couch_recipient_doc_type, 'CommCareCase')
self.assertEqual(call.couch_recipient, self.case.get_id)
self.assertEqual(call.direction, INCOMING)
示例3: handle
# 需要导入模块: from corehq.apps.sms.models import CallLog [as 别名]
# 或者: from corehq.apps.sms.models.CallLog import count_by_domain [as 别名]
def handle(self, *args, **options):
for domain in Domain.get_all():
count = (SMSLog.count_by_domain(domain.name) +
CallLog.count_by_domain(domain.name))
if count > 0:
if not domain.send_to_duplicated_case_numbers:
# if not True, explicitly set to False
print "Setting %s to False" % domain.name
domain.send_to_duplicated_case_numbers = False
domain.save()
else:
print "Setting %s to True" % domain.name
domain.send_to_duplicated_case_numbers = True
domain.save()