本文整理汇总了Python中corehq.form_processor.interfaces.FormProcessorInterface.hard_delete_case方法的典型用法代码示例。如果您正苦于以下问题:Python FormProcessorInterface.hard_delete_case方法的具体用法?Python FormProcessorInterface.hard_delete_case怎么用?Python FormProcessorInterface.hard_delete_case使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.form_processor.interfaces.FormProcessorInterface
的用法示例。
在下文中一共展示了FormProcessorInterface.hard_delete_case方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_sharing_form
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import hard_delete_case [as 别名]
def test_delete_sharing_form(self):
factory = CaseFactory()
c1, c2 = factory.create_or_update_cases([
CaseStructure(attrs={'create': True}),
CaseStructure(attrs={'create': True}),
])
with self.assertRaises(CommCareCaseError):
FormProcessorInterface.hard_delete_case(c1)
with self.assertRaises(CommCareCaseError):
FormProcessorInterface.hard_delete_case(c2)
self.assertIsNotNone(FormProcessorInterface.get_case(c1.id))
self.assertIsNotNone(FormProcessorInterface.get_case(c2.id))
示例2: test_simple_delete
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import hard_delete_case [as 别名]
def test_simple_delete(self):
factory = CaseFactory()
case = factory.create_case()
[case] = factory.create_or_update_case(CaseStructure(case_id=case._id, attrs={'update': {'foo': 'bar'}}))
self.assertIsNotNone(FormProcessorInterface.get_case(case.id))
self.assertEqual(2, len(case.xform_ids))
for form_id in case.xform_ids:
self.assertIsNotNone(FormProcessorInterface.get_xform(form_id))
FormProcessorInterface.hard_delete_case(case)
with self.assertRaises(CaseNotFound):
FormProcessorInterface.get_case(case.id)
for form_id in case.xform_ids:
with self.assertRaises(XFormNotFound):
FormProcessorInterface.get_xform(form_id)
示例3: test_delete_with_related
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import hard_delete_case [as 别名]
def test_delete_with_related(self):
factory = CaseFactory()
parent = factory.create_case()
[child] = factory.create_or_update_case(
CaseStructure(attrs={'create': True}, walk_related=False, indices=[
CaseIndex(CaseStructure(case_id=parent._id))
]),
)
# deleting the parent should not be allowed because the child still references it
with self.assertRaises(CommCareCaseError):
FormProcessorInterface.hard_delete_case(parent)
# deleting the child is ok
FormProcessorInterface.hard_delete_case(child)
self.assertIsNotNone(FormProcessorInterface.get_case(parent.id))
with self.assertRaises(CaseNotFound):
FormProcessorInterface.get_case(child.id)