Swap the refresher's httpx.Client for one bound to a mock transport. We rebuild with `follow_redirects=False` so the redirect-rejection test still exercises the real policy.
(refresher: Any, transport: Any)
| 573 | |
| 574 | |
| 575 | def _install_mock_transport(refresher: Any, transport: Any) -> None: |
| 576 | """Swap the refresher's httpx.Client for one bound to a mock transport. |
| 577 | |
| 578 | We rebuild with `follow_redirects=False` so the redirect-rejection |
| 579 | test still exercises the real policy. |
| 580 | """ |
| 581 | import httpx as _httpx |
| 582 | |
| 583 | refresher._http.close() |
| 584 | refresher._http = _httpx.Client(transport=transport, follow_redirects=False) |
| 585 | |
| 586 | |
| 587 | def test_refresher_returns_cached_token_when_fresh(tmp_path: Path) -> None: |
no test coverage detected