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

Method test_proxy_basic_auth

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

Source from the content-addressed store, hash-verified

1646 self.check_basic_auth(headers, realm)
1647
1648 def test_proxy_basic_auth(self):
1649 opener = OpenerDirector()
1650 ph = urllib.request.ProxyHandler(dict(http="proxy.example.com:3128"))
1651 opener.add_handler(ph)
1652 password_manager = MockPasswordManager()
1653 auth_handler = urllib.request.ProxyBasicAuthHandler(password_manager)
1654 realm = "ACME Networks"
1655 http_handler = MockHTTPHandlerRedirect(
1656 407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm)
1657 opener.add_handler(auth_handler)
1658 opener.add_handler(http_handler)
1659 self._test_basic_auth(opener, auth_handler, "Proxy-authorization",
1660 realm, http_handler, password_manager,
1661 "http://acme.example.com:3128/protected",
1662 "proxy.example.com:3128",
1663 )
1664
1665 def test_basic_and_digest_auth_handlers(self):
1666 # HTTPDigestAuthHandler raised an exception if it couldn't handle a 40*

Callers

nothing calls this directly

Calls 5

add_handlerMethod · 0.95
_test_basic_authMethod · 0.95
OpenerDirectorClass · 0.90
MockPasswordManagerClass · 0.85

Tested by

no test coverage detected