def test_pac_direct(self, monkeypatch): monkeypatch.setenv('HTTP_PROXY', 'http://env') with _patch_get_pac(PACFile(proxy_pac_js_tpl % 'DIRECT')): with pac_context_for_url(arbitrary_url): assert os.environ['HTTP_PROXY'] == '' assert os.environ['HTTPS_PROXY'] == '' assert os.environ['HTTP_PROXY'] == 'http://env'
def test_pac(self, monkeypatch): monkeypatch.setenv('HTTP_PROXY', 'http://env') with _patch_get_pac(PACFile(proxy_pac_js)): with pac_context_for_url(arbitrary_url): assert os.environ['HTTP_PROXY'] == fake_proxy_url assert os.environ['HTTPS_PROXY'] == fake_proxy_url assert os.environ['HTTP_PROXY'] == 'http://env'
def test_pac_direct(self, monkeypatch): monkeypatch.setenv("HTTP_PROXY", "http://env") with _patch_get_pac(PACFile(proxy_pac_js_tpl % "DIRECT")): with pac_context_for_url(arbitrary_url): assert os.environ["HTTP_PROXY"] == "" assert os.environ["HTTPS_PROXY"] == "" assert os.environ["HTTP_PROXY"] == "http://env"
def test_no_pac(self, monkeypatch): monkeypatch.setenv('HTTP_PROXY', 'http://env') with pac_context_for_url(arbitrary_url): assert os.environ['HTTP_PROXY'] == 'http://env' assert os.environ['HTTP_PROXY'] == 'http://env'
def test_no_pac_no_env(self, monkeypatch): monkeypatch.delenv('HTTP_PROXY', raising=False) monkeypatch.delenv('HTTPS_PROXY', raising=False) with pac_context_for_url(arbitrary_url): assert not os.environ.get('HTTP_PROXY') assert not os.environ.get('HTTP_PROXY')
def test_no_pac(self, monkeypatch): monkeypatch.setenv("HTTP_PROXY", "http://env") with pac_context_for_url(arbitrary_url): assert os.environ["HTTP_PROXY"] == "http://env" assert os.environ["HTTP_PROXY"] == "http://env"