mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
test(sessions): use mock.patch for the config gate, matching file idiom
This commit is contained in:
parent
99ffea6d00
commit
107843877f
1 changed files with 3 additions and 9 deletions
|
|
@ -1945,17 +1945,11 @@ class TestWebServerEndpoints:
|
|||
ws._last_auto_archive_check.clear()
|
||||
|
||||
# The helper imports load_config lazily from hermes_cli.config; patch there.
|
||||
import hermes_cli.config as _config_mod
|
||||
|
||||
def _cfg():
|
||||
return {"sessions": {"auto_archive": True, "auto_archive_days": 3, "min_interval_hours": 0}}
|
||||
|
||||
prev = _config_mod.load_config
|
||||
_config_mod.load_config = _cfg # type: ignore[assignment]
|
||||
cfg = {"sessions": {"auto_archive": True, "auto_archive_days": 3, "min_interval_hours": 0}}
|
||||
try:
|
||||
listed = self.client.get("/api/sessions").json()["sessions"]
|
||||
with patch("hermes_cli.config.load_config", return_value=cfg):
|
||||
listed = self.client.get("/api/sessions").json()["sessions"]
|
||||
finally:
|
||||
_config_mod.load_config = prev # type: ignore[assignment]
|
||||
ws._last_auto_archive_check.clear()
|
||||
|
||||
assert all(s["id"] != "stale-serve" for s in listed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue