| 220 | |
| 221 | @pytest.mark.anyio |
| 222 | async def test_custom_auth() -> None: |
| 223 | url = "https://example.org/" |
| 224 | app = App() |
| 225 | |
| 226 | def auth(request: httpx.Request) -> httpx.Request: |
| 227 | request.headers["Authorization"] = "Token 123" |
| 228 | return request |
| 229 | |
| 230 | async with httpx.AsyncClient(transport=httpx.MockTransport(app)) as client: |
| 231 | response = await client.get(url, auth=auth) |
| 232 | |
| 233 | assert response.status_code == 200 |
| 234 | assert response.json() == {"auth": "Token 123"} |
| 235 | |
| 236 | |
| 237 | def test_netrc_auth_credentials_exist() -> None: |