MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_proxy_https

Method test_proxy_https

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

Source from the content-addressed store, hash-verified

1472 self.assertEqual(req.host, "www.python.org")
1473
1474 def test_proxy_https(self):
1475 o = OpenerDirector()
1476 ph = urllib.request.ProxyHandler(dict(https="proxy.example.com:3128"))
1477 o.add_handler(ph)
1478 meth_spec = [
1479 [("https_open", "return response")]
1480 ]
1481 handlers = add_ordered_mock_handlers(o, meth_spec)
1482
1483 req = Request("https://www.example.com/")
1484 self.assertEqual(req.host, "www.example.com")
1485 o.open(req)
1486 self.assertEqual(req.host, "proxy.example.com:3128")
1487 self.assertEqual([(handlers[0], "https_open")],
1488 [tup[0:2] for tup in o.calls])
1489
1490 @unittest.skipUnless(hasattr(http.client, 'HTTPSConnection'), 'HTTPSConnection required for HTTPS tests.')
1491 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