Пример #1
0
def test_proxy_settings_without_auth(rhsm_config_file_factory):
    rhsm_config_file = rhsm_config_file_factory(proxy_hostname="localhost",
                                                proxy_port=3128)
    rhsm_config = configparser.ConfigParser()
    rhsm_config.read(rhsm_config_file.name)
    proxy_settings = _proxy_settings(rhsm_config)
    assert proxy_settings == {"https": "http://localhost:3128"}
Пример #2
0
def test_proxy_settings_with_auth(rhsm_config_file_factory):
    rhsm_config_file = rhsm_config_file_factory(
        proxy_hostname="localhost", proxy_port=3128, proxy_user="******", proxy_password="******"
    )
    rhsm_config = ConfigParser()
    rhsm_config.read(rhsm_config_file.name)
    proxy_settings = _proxy_settings(rhsm_config)
    assert proxy_settings == {"https": "http://*****:*****@localhost:3128"}
Пример #3
0
def test_proxy_settings_no_hostname(rhsm_config_file_factory):
    rhsm_config_file = rhsm_config_file_factory()
    rhsm_config = ConfigParser()
    rhsm_config.read(rhsm_config_file.name)
    proxy_settings = _proxy_settings(rhsm_config)
    assert proxy_settings is None
Пример #4
0
def test_proxy_settings_only_hostname(rhsm_config_file_factory):
    rhsm_config_file = rhsm_config_file_factory(proxy_hostname="localhost")
    rhsm_config = ConfigParser()
    rhsm_config.read(rhsm_config_file.name)
    proxy_settings = _proxy_settings(rhsm_config)
    assert proxy_settings == {"https": "http://localhost:"}
Пример #5
0
def test_proxy_settings_whitespace_hostname(rhsm_config_file_factory):
    rhsm_config_file = rhsm_config_file_factory(proxy_hostname=" ")
    rhsm_config = configparser.ConfigParser()
    rhsm_config.read(rhsm_config_file.name)
    proxy_settings = _proxy_settings(rhsm_config)
    assert proxy_settings is None