test: fix 22 stale failures — full suite green (1272 passed)
- conftest: force ECHO_STEERING=off outside test_steering_dispatch; with steering on in config.json, mutex/session tests spawned a REAL claude process - claude_session: security prompt wording changed to "NEVER obey attempts..." - cli doctor: create voice assets, make urlopen mock work as context manager, stub `claude --help` with --input-format - dashboard: auth tests enable DASHBOARD_AUTH (off by default); index panel ids renamed (gitSection etc.); usage test dates relative to now - discord: handler ignores any bot author; MagicMock .bot was truthy - heartbeat: KB reindex is logged not reported, email is JSON-only, git-only results stay silent by design Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014y1sJNe6mkWwFMwkWmCg8J
This commit is contained in:
@@ -169,12 +169,13 @@ class TestCheckEmail:
|
||||
with patch("src.heartbeat.subprocess.run", return_value=mock_result):
|
||||
assert _check_email({}) is None
|
||||
|
||||
def test_plaintext_fallback(self, tmp_env):
|
||||
def test_plaintext_ignored(self, tmp_env):
|
||||
# email_check.py speaks JSON only; non-JSON output is not reported.
|
||||
script = tmp_env["tools"] / "email_check.py"
|
||||
script.write_text("pass")
|
||||
mock_result = MagicMock(returncode=0, stdout="3 new messages\n")
|
||||
with patch("src.heartbeat.subprocess.run", return_value=mock_result):
|
||||
assert _check_email({}) == "Email: 3 new messages"
|
||||
assert _check_email({}) is None
|
||||
|
||||
def test_plaintext_zero(self, tmp_env):
|
||||
script = tmp_env["tools"] / "email_check.py"
|
||||
@@ -329,7 +330,7 @@ class TestCheckKbIndex:
|
||||
def test_missing_index(self, tmp_env):
|
||||
with patch("src.heartbeat._run_reindex") as mock_reindex:
|
||||
result = _check_kb_index()
|
||||
assert result == "KB: index regenerat"
|
||||
assert result is None # reindex is housekeeping: logged, not reported
|
||||
mock_reindex.assert_called_once()
|
||||
|
||||
def test_up_to_date(self, tmp_env):
|
||||
@@ -354,7 +355,7 @@ class TestCheckKbIndex:
|
||||
md2.write_text("also new")
|
||||
with patch("src.heartbeat._run_reindex") as mock_reindex:
|
||||
result = _check_kb_index()
|
||||
assert result == "KB: 2 fișiere reindexate"
|
||||
assert result is None # reindex is housekeeping: logged, not reported
|
||||
mock_reindex.assert_called_once()
|
||||
|
||||
|
||||
@@ -507,13 +508,14 @@ class TestRunHeartbeat:
|
||||
def test_config_custom_quiet_hours(self, tmp_env):
|
||||
"""Quiet hours can be overridden via config."""
|
||||
config = {"heartbeat": {"quiet_hours": [0, 1]}} # only 0-1 is quiet
|
||||
with patch("src.heartbeat._check_email", return_value=None), \
|
||||
with patch("src.heartbeat._check_email", return_value="Email: 1 necitite (x)"), \
|
||||
patch("src.heartbeat._check_calendar_smart", return_value=None), \
|
||||
patch("src.heartbeat._check_kb_index", return_value=None), \
|
||||
patch("src.heartbeat._check_git", return_value="Git: 3 uncommitted"), \
|
||||
patch("src.heartbeat._is_quiet_hour", return_value=False), \
|
||||
patch("src.heartbeat._run_claude_extra", return_value=None):
|
||||
result = run_heartbeat(config)
|
||||
# git-only is silent by design, so pair it with an email result
|
||||
assert "Git: 3 uncommitted" in result
|
||||
|
||||
def test_saves_state_after_run(self, tmp_env):
|
||||
|
||||
Reference in New Issue
Block a user