本文整理汇总了Python中casexml.apps.case.models.CommCareCase.get_with_rebuild方法的典型用法代码示例。如果您正苦于以下问题:Python CommCareCase.get_with_rebuild方法的具体用法?Python CommCareCase.get_with_rebuild怎么用?Python CommCareCase.get_with_rebuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类casexml.apps.case.models.CommCareCase
的用法示例。
在下文中一共展示了CommCareCase.get_with_rebuild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRebuildEmpty
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import get_with_rebuild [as 别名]
def testRebuildEmpty(self):
self.assertEqual(None, rebuild_case_from_forms('notarealid'))
try:
CommCareCase.get_with_rebuild('notarealid')
self.fail('get with rebuild should still fail for unknown cases')
except ResourceNotFound:
pass
示例2: testRebuildEmpty
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import get_with_rebuild [as 别名]
def testRebuildEmpty(self):
self.assertEqual(None, rebuild_case("notarealid"))
try:
CommCareCase.get_with_rebuild("notarealid")
self.fail("get with rebuild should still fail for unknown cases")
except ResourceNotFound:
pass
示例3: _get_case
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import get_with_rebuild [as 别名]
def _get_case(case_id):
if case_id in self._all_relevant_cases:
return self._all_relevant_cases[case_id]
else:
case = CommCareCase.get_with_rebuild(case_id)
self._all_relevant_cases[case_id] = case
return case
示例4: testRebuildCreateCase
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import get_with_rebuild [as 别名]
def testRebuildCreateCase(self):
case_id = _post_util(create=True)
_post_util(case_id=case_id, p1='p1', p2='p2')
# delete initial case
case = CommCareCase.get(case_id)
case.delete()
case = rebuild_case_from_forms(case_id)
self.assertEqual(case.p1, 'p1')
self.assertEqual(case.p2, 'p2')
self.assertEqual(2, len(primary_actions(case))) # create + update
case.delete()
try:
CommCareCase.get(case_id)
self.fail('get should fail on deleted cases')
except ResourceNotFound:
pass
case = CommCareCase.get_with_rebuild(case_id)
self.assertEqual(case.p1, 'p1')
self.assertEqual(case.p2, 'p2')
示例5: testRebuildCreateCase
# 需要导入模块: from casexml.apps.case.models import CommCareCase [as 别名]
# 或者: from casexml.apps.case.models.CommCareCase import get_with_rebuild [as 别名]
def testRebuildCreateCase(self):
case_id = post_util(create=True)
post_util(case_id=case_id, p1="p1", p2="p2")
# delete initial case
case = CommCareCase.get(case_id)
case.delete()
case = rebuild_case(case_id)
self.assertEqual(case.p1, "p1")
self.assertEqual(case.p2, "p2")
self.assertEqual(2, len(primary_actions(case))) # create + update
case.delete()
try:
CommCareCase.get(case_id)
self.fail("get should fail on deleted cases")
except ResourceNotFound:
pass
case = CommCareCase.get_with_rebuild(case_id)
self.assertEqual(case.p1, "p1")
self.assertEqual(case.p2, "p2")