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

Function test_basic_auth_with_stream

tests/client/test_auth.py:176–191  ·  view source on GitHub ↗

See: https://github.com/encode/httpx/pull/1312

()

Source from the content-addressed store, hash-verified

174
175@pytest.mark.anyio
176async def test_basic_auth_with_stream() -> None:
177 """
178 See: https://github.com/encode/httpx/pull/1312
179 """
180 url = "https://example.org/"
181 auth = ("user", "password123")
182 app = App()
183
184 async with httpx.AsyncClient(
185 transport=httpx.MockTransport(app), auth=auth
186 ) as client:
187 async with client.stream("GET", url) as response:
188 await response.aread()
189
190 assert response.status_code == 200
191 assert response.json() == {"auth": "Basic dXNlcjpwYXNzd29yZDEyMw=="}
192
193
194@pytest.mark.anyio

Callers

nothing calls this directly

Calls 4

AppClass · 0.85
jsonMethod · 0.80
streamMethod · 0.45
areadMethod · 0.45

Tested by

no test coverage detected