本文整理汇总了Python中corehq.apps.reminders.models.CaseReminderHandler.get_reminder方法的典型用法代码示例。如果您正苦于以下问题:Python CaseReminderHandler.get_reminder方法的具体用法?Python CaseReminderHandler.get_reminder怎么用?Python CaseReminderHandler.get_reminder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.reminders.models.CaseReminderHandler
的用法示例。
在下文中一共展示了CaseReminderHandler.get_reminder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KooKooTestCase
# 需要导入模块: from corehq.apps.reminders.models import CaseReminderHandler [as 别名]
# 或者: from corehq.apps.reminders.models.CaseReminderHandler import get_reminder [as 别名]
#.........这里部分代码省略.........
def kookoo_in(self, params):
"""
params should be a dictionary containing:
event, cid, sid, and (optionally) data
"""
params = urllib.urlencode(params)
url = "%s/kookoo/ivr/" % self.live_server_url
return urllib2.urlopen("%s?%s" % (url, params)).read()
def kookoo_finished(self, params):
"""
params should be a dictionary containing:
sid, status, and duration
"""
params = urllib.urlencode(params)
url = "%s/kookoo/ivr_finished/" % self.live_server_url
return urllib2.urlopen(url, params).read()
def testOutbound(self):
# Send an outbound call using self.reminder1 to self.case
# and answer it
CaseReminderHandler.now = datetime(2014, 6, 23, 10, 0)
self.case = CommCareCase.get(register_sms_contact(
self.domain,
'participant',
'case1',
self.user1._id,
'91000',
owner_id=self.groups[0]._id,
contact_ivr_backend_id='MOBILE_BACKEND_KOOKOO'
))
CaseReminderHandler.now = datetime(2014, 6, 23, 12, 0)
CaseReminderHandler.fire_reminders()
reminder = self.reminder1.get_reminder(self.case)
self.assertEquals(reminder.next_fire, datetime(2014, 6, 23, 12, 30))
call = self.get_last_outbound_call(self.case)
self.assertTrue(call.use_precached_first_response)
kookoo_session_id = call.gateway_session_id[7:]
resp = self.kookoo_in({
"cid": "0000",
"sid": kookoo_session_id,
"event": "NewCall",
})
self.assertEqual(resp, '<response sid="%s"><collectdtmf l="1" o="3000">'
'<playtext>How do you feel today? Press 1 for good, 2 for bad.'
'</playtext></collectdtmf></response>' % kookoo_session_id)
resp = self.kookoo_in({
"cid": "0000",
"sid": kookoo_session_id,
"event": "GotDTMF",
"data": "1",
})
self.assertEqual(resp, '<response sid="%s"><collectdtmf l="1" o="3000">'
'<playtext>Did you remember to take your meds today? Press 1 for yes, 2 for no.'
'</playtext></collectdtmf></response>' % kookoo_session_id)
resp = self.kookoo_in({
"cid": "0000",
"sid": kookoo_session_id,
"event": "GotDTMF",
"data": "2",
})
self.assertEqual(resp, '<response sid="%s"><hangup/></response>' % kookoo_session_id)