MCPcopy
hub / github.com/encode/httpx / test_digest_auth_with_200

Function test_digest_auth_with_200

tests/test_auth.py:29–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27
28
29def test_digest_auth_with_200():
30 auth = httpx.DigestAuth(username="user", password="pass")
31 request = httpx.Request("GET", "https://www.example.com")
32
33 # The initial request should not include an auth header.
34 flow = auth.sync_auth_flow(request)
35 request = next(flow)
36 assert "Authorization" not in request.headers
37
38 # If a 200 response is returned, then no other requests are made.
39 response = httpx.Response(content=b"Hello, world!", status_code=200)
40 with pytest.raises(StopIteration):
41 flow.send(response)
42
43
44def test_digest_auth_with_401():

Callers

nothing calls this directly

Calls 2

sync_auth_flowMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected