def test_config_file(config_dir):
    write_config('config', 'test')
    if not os.path.isfile(os.path.join(config_dir, 'config')):
        raise AssertionError
    if read_config('config') != 'test':
        raise AssertionError
    if read_config('none') is not None:
        raise AssertionError
Beispiel #2
0
def test_config_file(config_dir):
    write_config('config', 'test')
    assert os.path.isfile(os.path.join(config_dir, 'config'))
    assert read_config('config') == 'test'
    assert read_config('none') is None
def _load_access_token(domain: str) -> Optional[str]:
    value = read_config(f'pr-{domain}')
    if value:
        return json.loads(value)['token']
    return None
def _load_jenkins_token_auth(domain_key: str) -> Optional[Tuple[str, str]]:
    value = read_config(f'jenkins-{domain_key}')
    if value:
        j = json.loads(value)
        return (j['username'], j['token'])
    return None