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

Function test_auth_property

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

Source from the content-addressed store, hash-verified

321
322@pytest.mark.anyio
323async def test_auth_property() -> None:
324 app = App()
325
326 async with httpx.AsyncClient(transport=httpx.MockTransport(app)) as client:
327 assert client.auth is None
328
329 client.auth = ("user", "password123") # type: ignore
330 assert isinstance(client.auth, httpx.BasicAuth)
331
332 url = "https://example.org/"
333 response = await client.get(url)
334 assert response.status_code == 200
335 assert response.json() == {"auth": "Basic dXNlcjpwYXNzd29yZDEyMw=="}
336
337
338@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