コード例 #1
0
    def test_fetch_storage_for_chain_5(self):
        """获取链所依赖的存储节点

        :remark:
            链式关系:
                ident_7
        """

        tree_ident = 'tree_ident_3'
        storage_ident = 'ident_7'

        storages = tree_operation.FetchStorageForChain(tree_ident,
                                                       storage_ident).fetch()
        result = [storage['ident'] for storage in storages]
        assert result == ['ident_7']
コード例 #2
0
    def test_fetch_storage_for_chain_1(self):
        """获取链所依赖的存储节点

        :remark:
            链式关系:
                ident_1 <— ident_2 <— new_ident_3 <— ident_3 <— new_ident_1
        """

        tree_ident = 'tree_ident_1'
        storage_ident = 'new_ident_1'

        storages = tree_operation.FetchStorageForChain(tree_ident,
                                                       storage_ident).fetch()
        result = [storage['ident'] for storage in storages]
        assert result == ['ident_1', 'ident_2', 'ident_3']
コード例 #3
0
    def test_fetch_storage_for_chain_4(self):
        """获取链所依赖的存储节点

        :remark:
            链式关系:
                ident_4 <— ident_5 <— new_ident_4 <— ident_6
        """

        tree_ident = 'tree_ident_2'
        storage_ident = 'ident_6'

        storages = tree_operation.FetchStorageForChain(tree_ident,
                                                       storage_ident).fetch()
        result = [storage['ident'] for storage in storages]
        assert result == ['ident_4', 'ident_5', 'ident_6']
コード例 #4
0
def _test_box(tree_ident, storage_ident, chain_class, caller_name,
              assert_idents, storage_reference_manager):
    storages = tree_operation.FetchStorageForChain(tree_ident,
                                                   storage_ident).fetch()
    caller_name = caller_name
    chain_class = chain_class

    chain_obj = chain_operation.GenerateChain(
        storage_reference_manager=storage_reference_manager,
        caller_name=caller_name,
        storages_for_chain=storages,
        chain_class=chain_class).acquired_chain()

    key_storages = chain_obj.storages
    key_storage_idents = [storage['ident'] for storage in key_storages]
    assert key_storage_idents == assert_idents

    print(storage_reference_manager)
    chain_obj.release()
コード例 #5
0
 def _storages_for_chain(self):
     return tree_operation.FetchStorageForChain(self.tree_ident, self.parent_ident).fetch()