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


Python SimplifiedSyncLog.purge方法代码示例

本文整理汇总了Python中casexml.apps.phone.models.SimplifiedSyncLog.purge方法的典型用法代码示例。如果您正苦于以下问题:Python SimplifiedSyncLog.purge方法的具体用法?Python SimplifiedSyncLog.purge怎么用?Python SimplifiedSyncLog.purge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在casexml.apps.phone.models.SimplifiedSyncLog的用法示例。


在下文中一共展示了SimplifiedSyncLog.purge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_purge_self_indexing

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
 def test_purge_self_indexing(self):
     [id] = ['recursive']
     tree = IndexTree(indices={
         id: convert_list_to_dict([id]),
     })
     sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set([id]))
     sync_log.purge(id)
     self.assertFalse(id in sync_log.case_ids_on_phone)
     self.assertFalse(id in sync_log.dependent_case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:11,代码来源:test_index_tree.py

示例2: test_purge_extension_non_dependent_host

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
 def test_purge_extension_non_dependent_host(self):
     """Purging an extension should not remove the host or itself if the host is directly owned
     """
     [host_id, extension_id] = all_ids = ['host', 'extension']
     extension_tree = IndexTree(indices={
         extension_id: convert_list_to_dict([host_id]),
     })
     sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                  case_ids_on_phone=set(all_ids))
     sync_log.purge(extension_id)
     self.assertTrue(extension_id in sync_log.case_ids_on_phone)
     self.assertTrue(host_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:14,代码来源:test_index_tree.py

示例3: test_purge_partial_children

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
 def test_purge_partial_children(self):
     [parent_id, child_id_1, child_id_2] = all_ids = ['parent', 'child1', 'child2']
     tree = IndexTree(indices={
         child_id_1: convert_list_to_dict([parent_id]),
         child_id_2: convert_list_to_dict([parent_id]),
     })
     sync_log = SimplifiedSyncLog(
         index_tree=tree,
         case_ids_on_phone=set(all_ids),
         dependent_case_ids_on_phone=set([parent_id, child_id_2])
     )
     # this used to fail with an AssertionError
     sync_log.purge(parent_id)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:15,代码来源:test_index_tree.py

示例4: test_purge_extension

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_extension(self, ):
        """Purging extension removes host
        """
        [host_id, extension_id] = all_ids = ['host', 'extension']
        extension_tree = IndexTree(indices={
            extension_id: convert_list_to_dict([host_id]),
        })
        sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                     dependent_case_ids_on_phone=set([host_id]),
                                     case_ids_on_phone=set(all_ids))

        sync_log.purge(extension_id)
        self.assertFalse(extension_id in sync_log.case_ids_on_phone)
        self.assertFalse(host_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:16,代码来源:test_index_tree.py

示例5: test_purge_multiple_children

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_multiple_children(self):
        [grandparent_id, parent_id, child_id_1, child_id_2] = all_ids = ['rickard', 'ned', 'bran', 'arya']
        tree = IndexTree(indices={
            child_id_1: convert_list_to_dict([parent_id]),
            child_id_2: convert_list_to_dict([parent_id]),
            parent_id: convert_list_to_dict([grandparent_id]),
        })
        sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set(all_ids))

        # first purge the parent and grandparent
        sync_log.purge(grandparent_id)
        sync_log.purge(parent_id)
        self.assertTrue(grandparent_id in sync_log.case_ids_on_phone)
        self.assertTrue(grandparent_id in sync_log.dependent_case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.dependent_case_ids_on_phone)

        # just purging one child should preserve the parent index
        sync_log.purge(child_id_1)
        self.assertTrue(grandparent_id in sync_log.case_ids_on_phone)
        self.assertTrue(grandparent_id in sync_log.dependent_case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.dependent_case_ids_on_phone)
        self.assertFalse(child_id_1 in sync_log.case_ids_on_phone)

        # purging the other one should wipe it
        sync_log.purge(child_id_2)
        for id in all_ids:
            self.assertFalse(id in sync_log.case_ids_on_phone)
            self.assertFalse(id in sync_log.dependent_case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:32,代码来源:test_index_tree.py

示例6: test_purge_extension_host_has_multiple_extensions

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
 def test_purge_extension_host_has_multiple_extensions(self):
     """Purging an extension should remove host and its other extensions
     """
     [host_id, extension_id, extension_id_2] = all_ids = ['host', 'extension', 'extension_2']
     extension_tree = IndexTree(indices={
         extension_id: convert_list_to_dict([host_id]),
         extension_id_2: convert_list_to_dict([host_id]),
     })
     sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                  dependent_case_ids_on_phone=set([host_id, extension_id_2]),
                                  case_ids_on_phone=set(all_ids))
     sync_log.purge(extension_id)
     self.assertFalse(extension_id in sync_log.case_ids_on_phone)
     self.assertFalse(extension_id_2 in sync_log.case_ids_on_phone)
     self.assertFalse(host_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:17,代码来源:test_index_tree.py

示例7: test_open_extension_of_extension

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_open_extension_of_extension(self):
        all_ids = ['host', 'extension', 'extension_of_extension']
        host_id, extension_id, extension_of_extension_id = all_ids
        extension_tree = IndexTree(indices={
            extension_id: convert_list_to_dict([host_id]),
            extension_of_extension_id: convert_list_to_dict([extension_id]),
        })
        sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                     dependent_case_ids_on_phone=set([host_id, extension_id]),
                                     closed_cases=set([host_id, extension_id]),
                                     case_ids_on_phone=set(all_ids))

        sync_log.purge(host_id)
        self.assertFalse(host_id in sync_log.case_ids_on_phone)
        self.assertFalse(extension_id in sync_log.case_ids_on_phone)
        self.assertFalse(extension_of_extension_id in sync_log.case_ids_on_phone)
开发者ID:dimagi,项目名称:commcare-hq,代码行数:18,代码来源:test_index_tree.py

示例8: test_purge_circular_loops

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_circular_loops(self):
        [peer_id_1, peer_id_2] = all_ids = ['jaime', 'cersei']
        tree = IndexTree(indices={
            peer_id_1: convert_list_to_dict([peer_id_2]),
            peer_id_2: convert_list_to_dict([peer_id_1]),
        })
        sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set(all_ids))

        # purging one peer should keep everything around
        sync_log.purge(peer_id_1)
        for id in all_ids:
            self.assertTrue(id in sync_log.case_ids_on_phone)

        # purging the second peer should remove everything
        sync_log.purge(peer_id_2)
        for id in all_ids:
            self.assertFalse(id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:19,代码来源:test_index_tree.py

示例9: test_purge_parent_then_child

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_parent_then_child(self):
        [parent_id, child_id] = all_ids = ['parent', 'child']
        tree = IndexTree(indices={
            child_id: convert_list_to_dict([parent_id]),
        })
        sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set(all_ids))
        # this has no effect
        sync_log.purge(parent_id)
        self.assertTrue(child_id in sync_log.case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.case_ids_on_phone)
        self.assertFalse(child_id in sync_log.dependent_case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.dependent_case_ids_on_phone)

        # this should purge it entirely
        sync_log.purge(child_id)
        self.assertFalse(child_id in sync_log.case_ids_on_phone)
        self.assertFalse(parent_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:19,代码来源:test_index_tree.py

示例10: test_purge_very_circular_loops

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_very_circular_loops(self):
        [peer_id_1, peer_id_2, peer_id_3] = all_ids = ['drogon', 'rhaegal', 'viserion']
        tree = IndexTree(indices={
            peer_id_1: convert_list_to_dict([peer_id_2]),
            peer_id_2: convert_list_to_dict([peer_id_3]),
            peer_id_3: convert_list_to_dict([peer_id_1]),
        })
        sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set(all_ids))

        # purging the first two, should still keep everything around
        sync_log.purge(peer_id_1)
        sync_log.purge(peer_id_2)
        for id in all_ids:
            self.assertTrue(id in sync_log.case_ids_on_phone)

        sync_log.purge(peer_id_3)
        for id in all_ids:
            self.assertFalse(id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:20,代码来源:test_index_tree.py

示例11: test_purge_extension_host_is_parent

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_extension_host_is_parent(self):
        """Purging an extension should not purge the host or the extension if the host is a depenency for a child
        """
        [host_id, extension_id, child_id] = all_ids = ['host', 'extension', 'child']
        child_tree = IndexTree(indices={
            child_id: convert_list_to_dict([host_id]),
        })
        extension_tree = IndexTree(indices={
            extension_id: convert_list_to_dict([host_id]),
        })
        sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                     index_tree=child_tree,
                                     dependent_case_ids_on_phone=set([host_id]),
                                     case_ids_on_phone=set(all_ids))

        sync_log.purge(extension_id)
        self.assertTrue(extension_id in sync_log.case_ids_on_phone)
        self.assertTrue(child_id in sync_log.case_ids_on_phone)
        self.assertTrue(host_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:21,代码来源:test_index_tree.py

示例12: test_purge_child_of_extension

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_child_of_extension(self):
        """Purging child of extension should remove extension and host
        """
        [host_id, extension_id, child_id] = all_ids = ['host', 'extension', 'child']
        child_tree = IndexTree(indices={
            child_id: convert_list_to_dict([extension_id]),
        })
        extension_tree = IndexTree(indices={
            extension_id: convert_list_to_dict([host_id]),
        })
        sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                     index_tree=child_tree,
                                     dependent_case_ids_on_phone=set([host_id, extension_id]),
                                     case_ids_on_phone=set(all_ids))

        sync_log.purge(child_id)
        self.assertFalse(extension_id in sync_log.case_ids_on_phone)
        self.assertFalse(child_id in sync_log.case_ids_on_phone)
        self.assertFalse(host_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:21,代码来源:test_index_tree.py

示例13: test_open_child_of_extension

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_open_child_of_extension(self):
        [host_id, extension_id, child_of_extension_id] = all_ids = ['host', 'extension', 'child_of_extension']
        extension_tree = IndexTree(indices={
            extension_id: convert_list_to_dict([host_id]),

        })
        child_tree = IndexTree(indices={
            child_of_extension_id: convert_list_to_dict([extension_id]),
        })
        sync_log = SimplifiedSyncLog(extension_index_tree=extension_tree,
                                     index_tree=child_tree,
                                     dependent_case_ids_on_phone=set([host_id, extension_id]),
                                     closed_cases=set([host_id, extension_id]),
                                     case_ids_on_phone=set(all_ids))

        for case_id in [host_id, extension_id]:
            sync_log.purge(case_id)
            self.assertTrue(host_id in sync_log.case_ids_on_phone)
            self.assertTrue(extension_id in sync_log.case_ids_on_phone)
            self.assertTrue(child_of_extension_id in sync_log.case_ids_on_phone)
开发者ID:dimagi,项目名称:commcare-hq,代码行数:22,代码来源:test_index_tree.py

示例14: test_purge_tiered_top_down

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_tiered_top_down(self):
        [grandparent_id, parent_id, child_id] = all_ids = ['grandparent', 'parent', 'child']
        tree = IndexTree(indices={
            child_id: convert_list_to_dict([parent_id]),
            parent_id: convert_list_to_dict([grandparent_id]),
        })
        sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set(all_ids))

        # this has no effect other than to move the grandparent to dependent
        sync_log.purge(grandparent_id)
        for id in all_ids:
            self.assertTrue(id in sync_log.case_ids_on_phone)

        self.assertTrue(grandparent_id in sync_log.dependent_case_ids_on_phone)
        self.assertFalse(parent_id in sync_log.dependent_case_ids_on_phone)
        self.assertFalse(child_id in sync_log.dependent_case_ids_on_phone)

        # likewise, this should have no effect other than to move the parent to dependent
        sync_log.purge(parent_id)
        for id in all_ids:
            self.assertTrue(id in sync_log.case_ids_on_phone)

        self.assertTrue(grandparent_id in sync_log.dependent_case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.dependent_case_ids_on_phone)
        self.assertFalse(child_id in sync_log.dependent_case_ids_on_phone)

        # this should now purge everything
        sync_log.purge(child_id)
        for id in all_ids:
            self.assertFalse(id in sync_log.case_ids_on_phone)
            self.assertFalse(id in sync_log.dependent_case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:33,代码来源:test_index_tree.py

示例15: test_purge_tiered_bottom_up

# 需要导入模块: from casexml.apps.phone.models import SimplifiedSyncLog [as 别名]
# 或者: from casexml.apps.phone.models.SimplifiedSyncLog import purge [as 别名]
    def test_purge_tiered_bottom_up(self):
        [grandparent_id, parent_id, child_id] = all_ids = ['grandparent', 'parent', 'child']
        tree = IndexTree(indices={
            child_id: convert_list_to_dict([parent_id]),
            parent_id: convert_list_to_dict([grandparent_id]),
        })
        sync_log = SimplifiedSyncLog(index_tree=tree, case_ids_on_phone=set(all_ids))

        # just purging the child should purge just the child
        sync_log.purge(child_id)
        self.assertTrue(grandparent_id in sync_log.case_ids_on_phone)
        self.assertTrue(parent_id in sync_log.case_ids_on_phone)
        self.assertFalse(child_id in sync_log.case_ids_on_phone)

        # same for the parent
        sync_log.purge(parent_id)
        self.assertTrue(grandparent_id in sync_log.case_ids_on_phone)
        self.assertFalse(parent_id in sync_log.case_ids_on_phone)

        # same for the grandparentparent
        sync_log.purge(grandparent_id)
        self.assertFalse(grandparent_id in sync_log.case_ids_on_phone)
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:24,代码来源:test_index_tree.py


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