fix(tests): resolve all consistently failing tests

- test_plugins.py: remove tests for unimplemented plugin command API
  (get_plugin_command_handler, register_command never existed)
- test_redact.py: add autouse fixture to clear HERMES_REDACT_SECRETS
  env var leaked by cli.py import in other tests
- test_signal.py: same HERMES_REDACT_SECRETS fix for phone redaction
- test_mattermost.py: add @bot_user_id to test messages after the
  mention-only filter was added in #2443
- test_context_token_tracking.py: mock resolve_provider_client for
  openai-codex provider that requires real OAuth credentials

Full suite: 5893 passed, 0 failed.
This commit is contained in:
Teknium 2026-03-22 05:58:26 -07:00
parent 6435d69a6d
commit be3eb62047
No known key found for this signature in database
5 changed files with 33 additions and 149 deletions

View file

@ -279,7 +279,7 @@ class TestMattermostWebSocketParsing:
"id": "post_abc",
"user_id": "user_123",
"channel_id": "chan_456",
"message": "Hello from Matrix!",
"message": "@bot_user_id Hello from Matrix!",
}
event = {
"event": "posted",
@ -293,7 +293,7 @@ class TestMattermostWebSocketParsing:
await self.adapter._handle_ws_event(event)
assert self.adapter.handle_message.called
msg_event = self.adapter.handle_message.call_args[0][0]
assert msg_event.text == "Hello from Matrix!"
assert msg_event.text == "@bot_user_id Hello from Matrix!"
assert msg_event.message_id == "post_abc"
@pytest.mark.asyncio
@ -378,7 +378,7 @@ class TestMattermostWebSocketParsing:
"id": "post_reply",
"user_id": "user_123",
"channel_id": "chan_456",
"message": "Thread reply",
"message": "@bot_user_id Thread reply",
"root_id": "root_post_123",
}
event = {
@ -487,7 +487,7 @@ class TestMattermostDedup:
"id": "post_dup",
"user_id": "user_123",
"channel_id": "chan_456",
"message": "Hello!",
"message": "@bot_user_id Hello!",
}
event = {
"event": "posted",
@ -514,7 +514,7 @@ class TestMattermostDedup:
"id": pid,
"user_id": "user_123",
"channel_id": "chan_456",
"message": f"Message {i}",
"message": f"@bot_user_id Message {i}",
}
event = {
"event": "posted",
@ -593,7 +593,7 @@ class TestMattermostMediaTypes:
"id": "post_media",
"user_id": "user_123",
"channel_id": "chan_456",
"message": "file attached",
"message": "@bot_user_id file attached",
"file_ids": file_ids,
}
return {

View file

@ -229,6 +229,10 @@ class TestSignalSessionSource:
# ---------------------------------------------------------------------------
class TestSignalPhoneRedaction:
@pytest.fixture(autouse=True)
def _ensure_redaction_enabled(self, monkeypatch):
monkeypatch.delenv("HERMES_REDACT_SECRETS", raising=False)
def test_us_number(self):
from agent.redact import redact_sensitive_text
result = redact_sensitive_text("Call +15551234567 now")