MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / test_refresher_write_back_is_default

Function test_refresher_write_back_is_default

python/openshell/sandbox_test.py:841–860  ·  view source on GitHub ↗

Default IS write_back=True so refresh-token rotation propagates to disk for other processes (Rust CLI, TUI, second Python client).

(tmp_path: Path)

Source from the content-addressed store, hash-verified

839
840
841def test_refresher_write_back_is_default(tmp_path: Path) -> None:
842 """Default IS write_back=True so refresh-token rotation propagates to
843 disk for other processes (Rust CLI, TUI, second Python client)."""
844 _write_bundle(tmp_path, access_token="old", expires_at=1)
845 transport = _make_mock_transport(
846 refresh_responses=[
847 {
848 "access_token": "rotated",
849 "refresh_token": "r-new",
850 "expires_in": 3600,
851 }
852 ],
853 )
854 r = _OidcRefresher(tmp_path, "g") # default write_back=True
855 _install_mock_transport(r, transport)
856
857 r.current_access_token()
858 on_disk = json.loads((tmp_path / "oidc_token.json").read_text())
859 assert on_disk["access_token"] == "rotated"
860 assert on_disk["refresh_token"] == "r-new"
861
862
863def test_refresher_honors_refresh_token_rotation(tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 5

_OidcRefresherClass · 0.90
_write_bundleFunction · 0.85
_make_mock_transportFunction · 0.85
_install_mock_transportFunction · 0.85
current_access_tokenMethod · 0.80

Tested by

no test coverage detected