MCPcopy
hub / github.com/opentrace/opentrace / test_whoami_org_cached

Function test_whoami_org_cached

agent/tests/opentrace_agent/cli/test_auth.py:280–297  ·  view source on GitHub ↗
(tmp_path: Path, monkeypatch: object)

Source from the content-addressed store, hash-verified

278
279
280def test_whoami_org_cached(tmp_path: Path, monkeypatch: object) -> None:
281 _make_repo(tmp_path)
282 monkeypatch.chdir(tmp_path)
283 _patch_base_dir(monkeypatch, tmp_path, subdir="home_opentrace")
284
285 # Set up project config
286 ot_dir = tmp_path / ".opentrace"
287 ot_dir.mkdir(exist_ok=True)
288 save_config(ot_dir / "config.yaml", {"org": "org_cached"})
289
290 # Save tokens
291 save_tokens({"access_token": "otuat_user", "issuer": "https://api.opentrace.ai", "scope": "read write"})
292 save_org_token("org_cached", {"access_token": "otoat_org", "expires_at": int(time.time()) + 3600})
293
294 result = runner.invoke(app, ["whoami"])
295 assert result.exit_code == 0
296 assert "org_cached" in result.output
297 assert "(token cached)" in result.output
298
299
300def test_whoami_org_not_cached_resolve_fails(tmp_path: Path, monkeypatch: object) -> None:

Callers

nothing calls this directly

Calls 5

save_configFunction · 0.90
save_tokensFunction · 0.90
save_org_tokenFunction · 0.90
_make_repoFunction · 0.70
_patch_base_dirFunction · 0.70

Tested by

no test coverage detected