def test_config_is_loaded(self, tmpdir): path = str(tmpdir) config_path = os.path.join(path, '.chacractl') util.default_config_path = lambda: config_path util.ensure_default_config() module = util.load_config() assert module.user == 'chacra user' assert module.key == 'secret'
def api_credentials(self): util.ensure_default_config() user, key = os.environ.get("CHACRA_USER"), os.environ.get("CHACRA_KEY") if not user or not key: # check for the config file conf_module = util.load_config() user, key = conf_module.user, conf_module.key chacractl.config["credentials"] = (user, key) chacractl.config["url"] = conf_module.url
def api_credentials(self): util.ensure_default_config() user, key = os.environ.get('CHACRA_USER'), os.environ.get('CHACRA_KEY') if not user or not key: # check for the config file conf_module = util.load_config() user, key = conf_module.user, conf_module.key chacractl.config['credentials'] = (user, key) chacractl.config['url'] = conf_module.url chacractl.config['ssl_verify'] = getattr(conf_module, 'ssl_verify', True)
def test_no_config(self, tmpdir): path = str(tmpdir) config_path = os.path.join(path, '.chacractl') util.default_config_path = lambda: config_path module = util.load_config() assert module is None