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

Function test_basic_auth_on_session

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

Source from the content-addressed store, hash-verified

205
206@pytest.mark.anyio
207async def test_basic_auth_on_session() -> None:
208 url = "https://example.org/"
209 auth = ("user", "password123")
210 app = App()
211
212 async with httpx.AsyncClient(
213 transport=httpx.MockTransport(app), auth=auth
214 ) as client:
215 response = await client.get(url)
216
217 assert response.status_code == 200
218 assert response.json() == {"auth": "Basic dXNlcjpwYXNzd29yZDEyMw=="}
219
220
221@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