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

Method check_basic_auth

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

Source from the content-addressed store, hash-verified

1570 'expected bypass of %s to be False' % host)
1571
1572 def check_basic_auth(self, headers, realm):
1573 with self.subTest(realm=realm, headers=headers):
1574 opener = OpenerDirector()
1575 password_manager = MockPasswordManager()
1576 auth_handler = urllib.request.HTTPBasicAuthHandler(password_manager)
1577 body = '\r\n'.join(headers) + '\r\n\r\n'
1578 http_handler = MockHTTPHandlerRedirect(401, body)
1579 opener.add_handler(auth_handler)
1580 opener.add_handler(http_handler)
1581 self._test_basic_auth(opener, auth_handler, "Authorization",
1582 realm, http_handler, password_manager,
1583 "http://acme.example.com/protected",
1584 "http://acme.example.com/protected")
1585
1586 def test_basic_auth(self):
1587 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.80
joinMethod · 0.45

Tested by

no test coverage detected