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"}
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"}
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
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:"}
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