本文整理匯總了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)