(request: _httpx.Request)
| 552 | ) |
| 553 | |
| 554 | def handler(request: _httpx.Request) -> _httpx.Response: |
| 555 | if request.url.path.endswith("/.well-known/openid-configuration"): |
| 556 | if seen_discovery is not None: |
| 557 | seen_discovery.append(str(request.url)) |
| 558 | body = discovery or { |
| 559 | "issuer": DEFAULT_ISSUER, |
| 560 | "token_endpoint": DEFAULT_TOKEN_ENDPOINT, |
| 561 | } |
| 562 | return _httpx.Response(discovery_status, json=body) |
| 563 | # Anything else is a refresh exchange. |
| 564 | if seen_refresh is not None: |
| 565 | seen_refresh.append((str(request.url), bytes(request.content))) |
| 566 | try: |
| 567 | body = next(refresh_iter) |
| 568 | except StopIteration: |
| 569 | return _httpx.Response(500, json={"error": "test_script_exhausted"}) |
| 570 | return _httpx.Response(refresh_status, json=body) |
| 571 | |
| 572 | return _httpx.MockTransport(handler) |
| 573 |
nothing calls this directly
no test coverage detected