Ejemplo n.º 1
0
def test_config_load_value_error(open_):
    # defaults on incorrect conf
    open_.return_value = TextIOWrapper(
        BytesIO(b'[insights-client]\nhttp_timeout=ZGOK'))
    c = InsightsConfig()
    c.load_config_file()
    assert c.http_timeout == DEFAULT_OPTS['http_timeout']['default']
Ejemplo n.º 2
0
def test_config_load_legacy_ignored(open_):
    open_.return_value = TextIOWrapper(
        BytesIO(b'[insights-client]\nusername=CASVAL\n'
                b'[redhat-access-insights]\nusername=SAYLA'))
    c = InsightsConfig()
    c.load_config_file()
    assert c.username == 'CASVAL'
Ejemplo n.º 3
0
def test_config_load_section_error(open_):
    # defaults on incorrect conf
    open_.return_value = TextIOWrapper(
        BytesIO(b'aFUHAEFJhFhlAFJKhnfjeaf\nusername=RAMBA'))
    c = InsightsConfig()
    c.load_config_file()
    assert c.username == DEFAULT_OPTS['username']['default']
Ejemplo n.º 4
0
def test_config_load(open_):
    open_.return_value = TextIOWrapper(
        BytesIO(b'[insights-client]\nusername=AMURO'))
    c = InsightsConfig()
    c.load_config_file()
    assert c.username == 'AMURO'
Ejemplo n.º 5
0
def test_config_load_legacy(open_):
    open_.return_value = TextIOWrapper(
        BytesIO(b'[redhat-access-insights]\nusername=BRIGHT'))
    c = InsightsConfig()
    c.load_config_file()
    assert c.username == 'BRIGHT'