当前位置: 首页>>代码示例>>Python>>正文


Python FormProcessorInterface.soft_delete_case方法代码示例

本文整理汇总了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))
开发者ID:johan--,项目名称:commcare-hq,代码行数:35,代码来源:retire.py

示例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)
开发者ID:johan--,项目名称:commcare-hq,代码行数:13,代码来源:test_case_assigment.py


注:本文中的corehq.form_processor.interfaces.FormProcessorInterface.soft_delete_case方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。