Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/test_wakatime_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

import kiro_crew.dashboard.handlers.wakatime as wt
import kiro_crew.wakatime.service as wt_service
from kiro_crew.config import live
from kiro_crew.dashboard.handlers.wakatime import _csv_safe, _rows_by_project
from kiro_crew.secrets import read_audit


class _StubClient:
Expand Down Expand Up @@ -496,11 +498,18 @@ def _load(cls: Any) -> Any:
return _Cfg()

monkeypatch.setattr("kiro_crew.config.loader.KiroCrewConfig.load", classmethod(_load))
# The secret read beside the client-id read asks the vault's read audit
# whether it is on; with no live snapshot that loads config.json once per
# TTL and caches the answer process-wide. Start both cold so the count does
# not depend on which test ran first: one load for the client id, one for
# the audit switch.
monkeypatch.setattr(live, "snapshot", lambda: None)
monkeypatch.setattr(read_audit, "_loaded", None)
async with TestClient(TestServer(_oauth_app())) as client:
resp = await client.get("/api/wakatime/oauth/status")
assert resp.status == 200
assert (await resp.json())["client_configured"] is True
assert on_loop == [False]
assert on_loop == [False, False]


@pytest.mark.asyncio
Expand Down
Loading