def test_extras(): c = Config.load(noflagrc=True) args = Namespace(api_token='abcd', iscore_url=None, api_version=None, save=False) c.merge(args) extras = c.request_extras() assert 'Authorization' in extras['headers'] assert extras['headers']['Authorization'] == 'Token abcd'
def test_merge_no_prompt(mocker): c = Config.load(noflagrc=True) args = Namespace(api_token=None, iscore_url=None, api_version=None, save=False, prompt=False) input_mock = mocker.patch('flag_bearer.config.input') getpass_mock = mocker.patch('flag_bearer.config.getpass') c.merge(args) input_mock.assert_not_called getpass_mock.assert_not_called
def test_merge(): c = Config.load(noflagrc=True) args = Namespace(api_token='abcd', iscore_url=None, api_version=None, save=False) c.merge(args) assert c.api_token == 'abcd' assert c.get('iscore', 'base_url') == 'https://iscore.iseage.org' assert c.get('iscore', 'api_version') == 'v1' assert not c.has_option('iscore', 'force_save')
def test_load(): c = Config.load(noflagrc=True) assert c.get('iscore', 'api_version') == 'v1' assert c.get('iscore', 'base_url') == 'https://iscore.iseage.org'
def config(): conf = Config.load(noflagrc=True) args = Namespace(api_token='32257d57fcae845fc89db97a0835c78b60fb8adb', iscore_url='http://localhost:8000', api_version=None, save=False) conf.merge(args) return conf