| 321 | |
| 322 | @pytest.mark.anyio |
| 323 | async 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 |