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

Function test_basic_auth

tests/client/test_auth.py:163–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161
162@pytest.mark.anyio
163async def test_basic_auth() -> None:
164 url = "https://example.org/"
165 auth = ("user", "password123")
166 app = App()
167
168 async with httpx.AsyncClient(transport=httpx.MockTransport(app)) as client:
169 response = await client.get(url, auth=auth)
170
171 assert response.status_code == 200
172 assert response.json() == {"auth": "Basic dXNlcjpwYXNzd29yZDEyMw=="}
173
174
175@pytest.mark.anyio

Callers

nothing calls this directly

Calls 3

AppClass · 0.85
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected