def test_http_is_fallback_for_https(): set_proxies(http_proxy=None, https_proxy='pass', all_proxy='all') config = Config() config.url = 'https://localhost' assert config.proxy == 'pass' config.url = 'http://localhost' assert config.proxy == 'all'
def test_https_preferred_over_http(): set_proxies(http_proxy='pass', https_proxy='https', all_proxy=None) config = Config() config.url = 'https://localhost' assert config.proxy == 'https' config.url = 'http://localhost' assert config.proxy == 'pass'
def test_http_proxy_fallback_for_https_url(): set_proxies(http_proxy='pass', https_proxy=None, all_proxy=None) config = Config() config.url = 'https://localhost' assert config.proxy == 'pass' unset_proxies()
def test_config_assignments(): config = Config() config.url = 'http://somewhere' assert config.url == 'http://somewhere' config.accesskey = '123' assert config.accesskey == '123' config.username = '******' assert config.username == 'bob' config.predict = True assert config.predict is True config.predict_version = 3 assert config.predict_version == 3
def test_commandline_overrides_other_settings(): config = Config([__name__, '--proxy=PASS']) config.url = 'http://localhost' assert config.proxy == 'PASS'