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

Method check_basic_auth

Lib/test/test_urllib2.py:1589–1601  ·  view source on GitHub ↗
(self, headers, realm)

Source from the content-addressed store, hash-verified

1587 'expected bypass of %s to be False' % host)
1588
1589 def check_basic_auth(self, headers, realm):
1590 with self.subTest(realm=realm, headers=headers):
1591 opener = OpenerDirector()
1592 password_manager = MockPasswordManager()
1593 auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
1594 body = '\r\n'.join(headers) + '\r\n\r\n'
1595 http_handler = MockHTTPHandlerRedirect(401, body)
1596 opener.add_handler(auth_handler)
1597 opener.add_handler(http_handler)
1598 self._test_basic_auth(opener, auth_handler, "Authorization",
1599 realm, http_handler, password_manager,
1600 "http://acme.example.com/protected",
1601 "http://acme.example.com/protected")
1602
1603 def test_basic_auth(self):
1604 realm = "realm2@example.com"

Callers 1

test_basic_authMethod · 0.95

Calls 7

add_handlerMethod · 0.95
_test_basic_authMethod · 0.95
OpenerDirectorClass · 0.90
MockPasswordManagerClass · 0.85
subTestMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected