(tmp_path: Path, monkeypatch: object)
| 278 | |
| 279 | |
| 280 | def 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 | |
| 300 | def test_whoami_org_not_cached_resolve_fails(tmp_path: Path, monkeypatch: object) -> None: |
nothing calls this directly
no test coverage detected