當前位置: 首頁>>代碼示例>>Python>>正文


Python FormProcessorInterface.hard_delete_case方法代碼示例

本文整理匯總了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))
開發者ID:johan--,項目名稱:commcare-hq,代碼行數:16,代碼來源:test_delete.py

示例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)
開發者ID:johan--,項目名稱:commcare-hq,代碼行數:18,代碼來源:test_delete.py

示例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)
開發者ID:johan--,項目名稱:commcare-hq,代碼行數:19,代碼來源:test_delete.py


注:本文中的corehq.form_processor.interfaces.FormProcessorInterface.hard_delete_case方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。