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)
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']
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"]
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)
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)
def test_default_config(): cfg = config.get_config(None) assert default_config == cfg assert '__config_dir__' not in cfg
def test_config_dir(): with pytest.raises(IOError): config.get_config('nonexistant')