本文整理汇总了Python中corehq.form_processor.interfaces.FormProcessorInterface.soft_delete_case方法的典型用法代码示例。如果您正苦于以下问题:Python FormProcessorInterface.soft_delete_case方法的具体用法?Python FormProcessorInterface.soft_delete_case怎么用?Python FormProcessorInterface.soft_delete_case使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.form_processor.interfaces.FormProcessorInterface
的用法示例。
在下文中一共展示了FormProcessorInterface.soft_delete_case方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deleted_indices_removed
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import soft_delete_case [as 别名]
def test_deleted_indices_removed(self):
factory = CaseFactory(
self.domain,
case_defaults={
'user_id': self.commcare_user._id,
'owner_id': self.commcare_user._id,
'case_type': 'a-case',
'create': True,
},
)
# create a parent/child set of cases
parent_id, child_id = [uuid.uuid4().hex for i in range(2)]
child, parent = factory.create_or_update_case(CaseStructure(
case_id=child_id,
indices=[
CaseIndex(CaseStructure(case_id=parent_id))
]
))
# confirm the child has an index, and 1 form
self.assertEqual(1, len(child.indices))
self.assertEqual(parent_id, child.indices[0].referenced_id)
self.assertEqual(1, len(child.xform_ids))
# simulate parent deletion
FormProcessorInterface.soft_delete_case(parent_id)
# call the remove index task
remove_indices_from_deleted_cases(self.domain, [parent_id])
# check that the index is removed via a new form
child = CommCareCase.get(child_id)
self.assertEqual(0, len(child.indices))
self.assertEqual(2, len(child.xform_ids))
示例2: test_assign_bad_index_ref
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import soft_delete_case [as 别名]
def test_assign_bad_index_ref(self):
# the case has to exist to create the index, but if we delete it later the assignment
# shouldn't fail
case = self._new_case()
case_with_bad_ref = self._new_case(index={"parent": ("person", case._id)})
FormProcessorInterface.soft_delete_case(case._id)
# this call previously failed
res = assign_case(case_with_bad_ref.id, self.primary_user._id, include_subcases=True, include_parent_cases=True)
self.assertEqual(2, len(res))
self.assertIn(case_with_bad_ref._id, res)
self.assertIn(case._id, res)