MCPcopy Index your code
hub / github.com/python/cpython / test_proxy_https

Method test_proxy_https

Lib/test/test_urllib2.py:1491–1505  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1489 self.assertEqual(req.host, "www.python.org")
1490
1491 def test_proxy_https(self):
1492 o = OpenerDirector()
1493 ph = urllib.request.ProxyHandler(dict(https="proxy.example.com:3128"))
1494 o.add_handler(ph)
1495 meth_spec = [
1496 [("https_open", "return response")]
1497 ]
1498 handlers = add_ordered_mock_handlers(o, meth_spec)
1499
1500 req = Request("https://www.example.com/")
1501 self.assertEqual(req.host, "www.example.com")
1502 o.open(req)
1503 self.assertEqual(req.host, "proxy.example.com:3128")
1504 self.assertEqual([(handlers[0], "https_open")],
1505 [tup[0:2] for tup in o.calls])
1506
1507 @unittest.skipUnless(hasattr(http.client, 'HTTPSConnection'), 'HTTPSConnection required for HTTPS tests.')
1508 def test_proxy_https_proxy_authorization(self):

Callers

nothing calls this directly

Calls 6

add_handlerMethod · 0.95
openMethod · 0.95
OpenerDirectorClass · 0.90
RequestClass · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected