本文整理匯總了Python中corehq.apps.sms.mixin.MobileBackend.save方法的典型用法代碼示例。如果您正苦於以下問題:Python MobileBackend.save方法的具體用法?Python MobileBackend.save怎麽用?Python MobileBackend.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類corehq.apps.sms.mixin.MobileBackend
的用法示例。
在下文中一共展示了MobileBackend.save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: bootstrap
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import save [as 別名]
def bootstrap(id=None, to_console=''):
"""
Create an instance of the test backend in the database
"""
backend = MobileBackend(
domain=[],
description='test backend',
outbound_module='corehq.apps.sms.backend.test',
outbound_params={'to_console': True}
)
if id:
backend._id = id
backend.save(**get_safe_write_kwargs())
return backend
示例2: KooKooTestCase
# 需要導入模塊: from corehq.apps.sms.mixin import MobileBackend [as 別名]
# 或者: from corehq.apps.sms.mixin.MobileBackend import save [as 別名]
class KooKooTestCase(TouchformsTestCase):
"""
Must be run manually (see corehq.apps.sms.tests.util.TouchformsTestCase)
"""
def setUp(self):
super(KooKooTestCase, self).setUp()
self.ivr_backend = MobileBackend(
_id="MOBILE_BACKEND_KOOKOO",
outbound_module="corehq.apps.kookoo.api",
outbound_params={"is_test": True, "api_key": "xyz"},
)
self.ivr_backend.save()
self.user1 = self.create_mobile_worker("user1", "123", "91001", save_vn=False)
self.user2 = self.create_mobile_worker("user2", "123", "91002", save_vn=False)
self.create_group("group1", [self.user1, self.user2])
self.case = CommCareCase(
domain=self.domain,
type="participant",
owner_id=self.groups[0]._id,
)
self.case.set_case_property("contact_phone_number", "91000")
self.case.set_case_property("contact_phone_number_is_verified", "1")
self.case.set_case_property("contact_ivr_backend_id", "MOBILE_BACKEND_KOOKOO")
self.case.save()
dirname = os.path.dirname(os.path.abspath(__file__))
self.load_app("app1.json", dirname)
self.load_app("app2.json", dirname)
self.reminder1 = CaseReminderHandler(
domain=self.domain,
active=True,
case_type="participant",
method=METHOD_IVR_SURVEY,
recipient=RECIPIENT_CASE,
sample_id=None,
user_group_id=None,
user_id=None,
case_id=None,
reminder_type=REMINDER_TYPE_DEFAULT,
submit_partial_forms=True,
include_case_side_effects=False,
max_question_retries=5,
start_condition_type=CASE_CRITERIA,
start_property="name",
start_value="case1",
start_date=None,
start_offset=0,
start_match_type=MATCH_EXACT,
events=[
CaseReminderEvent(
day_num=0,
fire_time=time(12,0),
fire_time_type=FIRE_TIME_DEFAULT,
callback_timeout_intervals=[30],
form_unique_id=self.apps[0].modules[0].forms[0].unique_id,
),
CaseReminderEvent(
day_num=0,
fire_time=time(13,0),
fire_time_type=FIRE_TIME_DEFAULT,
callback_timeout_intervals=[30],
form_unique_id=self.apps[0].modules[0].forms[1].unique_id,
),
],
schedule_length=1,
event_interpretation=EVENT_AS_SCHEDULE,
max_iteration_count=7,
until=None,
force_surveys_to_use_triggered_case=False,
)
self.reminder1.save()
self.reminder2 = CaseReminderHandler(
domain=self.domain,
active=True,
case_type="participant",
method=METHOD_IVR_SURVEY,
recipient=RECIPIENT_OWNER,
sample_id=None,
user_group_id=None,
user_id=None,
case_id=None,
reminder_type=REMINDER_TYPE_DEFAULT,
submit_partial_forms=True,
include_case_side_effects=True,
max_question_retries=5,
start_condition_type=CASE_CRITERIA,
start_property="name",
start_value="case2",
start_date=None,
start_offset=0,
start_match_type=MATCH_EXACT,
events=[
CaseReminderEvent(
day_num=0,
fire_time=time(12,0),
#.........這裏部分代碼省略.........