A mock app to test auth credentials.
| 21 | |
| 22 | |
| 23 | class App: |
| 24 | """ |
| 25 | A mock app to test auth credentials. |
| 26 | """ |
| 27 | |
| 28 | def __init__(self, auth_header: str = "", status_code: int = 200) -> None: |
| 29 | self.auth_header = auth_header |
| 30 | self.status_code = status_code |
| 31 | |
| 32 | def __call__(self, request: httpx.Request) -> httpx.Response: |
| 33 | headers = {"www-authenticate": self.auth_header} if self.auth_header else {} |
| 34 | data = {"auth": request.headers.get("Authorization")} |
| 35 | return httpx.Response(self.status_code, headers=headers, json=data) |
| 36 | |
| 37 | |
| 38 | class DigestApp: |
no outgoing calls