本文整理汇总了Python中corehq.form_processor.interfaces.FormProcessorInterface.create_case_from_generic方法的典型用法代码示例。如果您正苦于以下问题:Python FormProcessorInterface.create_case_from_generic方法的具体用法?Python FormProcessorInterface.create_case_from_generic怎么用?Python FormProcessorInterface.create_case_from_generic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.form_processor.interfaces.FormProcessorInterface
的用法示例。
在下文中一共展示了FormProcessorInterface.create_case_from_generic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_normal_index
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import create_case_from_generic [as 别名]
def test_normal_index(self):
cp = FormProcessorInterface.create_case_from_generic(GenericCommCareCase(
id='parent',
name='parent',
type='parent',
))
FormProcessorInterface.create_case_from_generic(GenericCommCareCase(
id='child',
name='child',
type='child',
indices=[GenericCommCareCaseIndex(
identifier='parent',
referenced_type='parent',
referenced_id='parent'
)],
))
hierarchy = get_case_hierarchy(cp, {})
self.assertEqual(2, len(hierarchy['case_list']))
self.assertEqual(1, len(hierarchy['child_cases']))
示例2: test_recursive_indexes
# 需要导入模块: from corehq.form_processor.interfaces import FormProcessorInterface [as 别名]
# 或者: from corehq.form_processor.interfaces.FormProcessorInterface import create_case_from_generic [as 别名]
def test_recursive_indexes(self):
c = FormProcessorInterface.create_case_from_generic(GenericCommCareCase(
id='infinite-recursion',
name='infinite_recursion',
type='bug',
indices=[GenericCommCareCaseIndex(
identifier='self',
referenced_type='bug',
referenced_id='infinite-recursion'
)],
))
# this call used to fail with infinite recursion
hierarchy = get_case_hierarchy(c, {})
self.assertEqual(1, len(hierarchy['case_list']))