コード例 #1
0
ファイル: client.py プロジェクト: ccaputo/peeringdb-py
 def __init__(self, **kwargs):
     # try to load config
     cfg = config.get_config(conf_dir=kwargs.get('conf_dir', config.default_conf_dir))
     pdb = cfg['peeringdb']
     # override config with kwargs
     munge.util.recursive_update(pdb, kwargs)
     super(PeeringDB, self).__init__(**pdb)
コード例 #2
0
def test_config0():
    cfg_dir = os.path.join(test_dir, 'data', 'config0')
    cfg = config.get_config(cfg_dir)

    assert cfg_dir == cfg['__config_dir__']

    assert default_config['database'] == cfg['database']
    assert default_config['peeringdb'] != cfg['peeringdb']
    assert 60 == cfg['peeringdb']['timeout']
コード例 #3
0
ファイル: test_config.py プロジェクト: mahtin/peeringdb-py
def test_config0():
    cfg_dir = os.path.join(test_dir, 'data', 'config0')
    cfg = config.get_config(cfg_dir)

    assert cfg_dir == cfg['__config_dir__']

    assert default_config['database'] == cfg['database']
    assert default_config['peeringdb'] != cfg['peeringdb']
    assert 60 == cfg['peeringdb']['timeout']
コード例 #4
0
def test_config0():
    cfg_dir = os.path.join(test_dir, "data", "config0")
    cfg = config.get_config(cfg_dir)

    assert cfg_dir == cfg["__config_dir__"]

    assert default_config["database"] == cfg["database"]
    assert default_config["peeringdb"] != cfg["peeringdb"]
    assert 60 == cfg["peeringdb"]["timeout"]
コード例 #5
0
ファイル: client.py プロジェクト: mahtin/peeringdb-py
 def __init__(self, **kwargs):
     """
     options:
         conf_dir : directory to load config from
         url      : URL to connect to
         user     : user to connect as
         password : password to use
         timeout  : timeout to fail after
     """
     # try to load config
     cfg = config.get_config(conf_dir=kwargs.get('conf_dir', config.default_conf_dir))
     self.config = cfg['peeringdb']
     # override config with kwargs
     munge.util.recursive_update(self.config, kwargs)
     super(PeeringDB, self).__init__(**self.config)
コード例 #6
0
 def __init__(self, **kwargs):
     """
     options:
         conf_dir : directory to load config from
         url      : URL to connect to
         user     : user to connect as
         password : password to use
         timeout  : timeout to fail after
     """
     # try to load config
     cfg = config.get_config(
         conf_dir=kwargs.get('conf_dir', config.default_conf_dir))
     self.config = cfg['peeringdb']
     # override config with kwargs
     munge.util.recursive_update(self.config, kwargs)
     super(PeeringDB, self).__init__(**self.config)
コード例 #7
0
def test_default_config():
    cfg = config.get_config(None)
    assert default_config == cfg
    assert '__config_dir__' not in cfg
コード例 #8
0
def test_config_dir():
    with pytest.raises(IOError):
        config.get_config('nonexistant')
コード例 #9
0
ファイル: test_config.py プロジェクト: mahtin/peeringdb-py
def test_config_dir():
    with pytest.raises(IOError):
        config.get_config('nonexistant')
コード例 #10
0
ファイル: test_config.py プロジェクト: mahtin/peeringdb-py
def test_default_config():
    cfg = config.get_config(None)
    assert default_config == cfg
    assert '__config_dir__' not in cfg