()
| 205 | |
| 206 | @pytest.mark.anyio |
| 207 | async 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 |