Esempio n. 1
0
 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)
Esempio n. 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']
Esempio n. 3
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']
Esempio n. 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"]
Esempio n. 5
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)
Esempio n. 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)
Esempio n. 7
0
def test_default_config():
    cfg = config.get_config(None)
    assert default_config == cfg
    assert '__config_dir__' not in cfg
Esempio n. 8
0
def test_config_dir():
    with pytest.raises(IOError):
        config.get_config('nonexistant')
Esempio n. 9
0
def test_config_dir():
    with pytest.raises(IOError):
        config.get_config('nonexistant')
Esempio n. 10
0
def test_default_config():
    cfg = config.get_config(None)
    assert default_config == cfg
    assert '__config_dir__' not in cfg