Esempio n. 1
0
def test_config_consume_chain():

    test_config = {}

    test_config.update(test_pool_config)

    test_config.update(test_session_config)

    consumed_pool_config, consumed_session_config = Config.consume_chain(
        test_config, PoolConfig, SessionConfig)

    assert isinstance(consumed_pool_config, PoolConfig)
    assert isinstance(consumed_session_config, SessionConfig)

    assert len(test_config) == 0

    for key, val in test_pool_config.items():
        assert consumed_pool_config[key] == val

    for key, val in consumed_pool_config.items():
        if key not in config_function_names:
            assert test_pool_config[key] == val

    assert len(consumed_pool_config) - len(config_function_names) == len(
        test_pool_config)

    assert len(consumed_session_config) - len(config_function_names) == len(
        test_session_config)
Esempio n. 2
0
 def open(cls, target, *, auth=None, **config):
     from neo4j.io import BoltPool
     address = cls.parse_target(target)
     pool_config, session_config = Config.consume_chain(
         config, PoolConfig, SessionConfig)
     pool = BoltPool.open(address, auth=auth, **pool_config)
     return cls(pool, session_config)
Esempio n. 3
0
 def open(cls, target, *, auth=None, **config):
     from neo4j.io import BoltPool
     from neo4j.work import WorkspaceConfig
     address = cls.parse_target(target)
     pool_config, default_workspace_config = Config.consume_chain(
         config, PoolConfig, WorkspaceConfig)
     pool = BoltPool.open(address, auth=auth, **pool_config)
     return cls(pool, default_workspace_config)
Esempio n. 4
0
 def open(cls, *targets, auth=None, routing_context=None, **config):
     from neo4j.io import Neo4jPool
     addresses = cls.parse_targets(*targets)
     pool_config, session_config = Config.consume_chain(
         config, PoolConfig, SessionConfig)
     pool = Neo4jPool.open(*addresses,
                           auth=auth,
                           routing_context=routing_context,
                           **pool_config)
     return cls(pool, session_config)
Esempio n. 5
0
 def open(cls, *targets, auth=None, routing_context=None, **config):
     from neo4j.io import Neo4jPool
     from neo4j.work import WorkspaceConfig
     addresses = cls.parse_targets(*targets)
     pool_config, default_workspace_config = Config.consume_chain(
         config, PoolConfig, WorkspaceConfig)
     pool = Neo4jPool.open(*addresses,
                           auth=auth,
                           routing_context=routing_context,
                           **pool_config)
     return cls(pool, default_workspace_config)
Esempio n. 6
0
    def open(cls, target, *, auth=None, **config):
        """
        :param target:
        :param auth:
        :param config: The values that can be specified are found in :class: `neo4j.PoolConfig` and :class: `neo4j.WorkspaceConfig`

        :return:
        :rtype: :class: `neo4j.BoltDriver`
        """
        from neo4j.io import BoltPool
        address = cls.parse_target(target)
        pool_config, default_workspace_config = Config.consume_chain(
            config, PoolConfig, WorkspaceConfig)
        pool = BoltPool.open(address,
                             auth=auth,
                             pool_config=pool_config,
                             workspace_config=default_workspace_config)
        return cls(pool, default_workspace_config)