fix: repair broken tests across alert, chanmgmt, and integration

- test_alert: remove stale _MAX_ANNOUNCE import/test, update _errors
  assertions for per-backend dict, fix announcement checks (action vs
  send), mock _fetch_og_batch in seeding tests, fix YouTube/SearX mock
  targets (urllib.request.urlopen), include keyword in fake data titles
- test_chanmgmt: add _FakeState to _FakeBot (on_invite now persists)
- test_integration: update help assertion for new output format

696 tests pass, 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-17 21:14:44 +01:00
parent 94f563d55a
commit 7606280358
3 changed files with 114 additions and 101 deletions

View File

@@ -31,6 +31,26 @@ class _FakeConn:
self.sent.append(raw)
class _FakeState:
"""In-memory stand-in for bot.state."""
def __init__(self):
self._store: dict[str, dict[str, str]] = {}
def get(self, plugin: str, key: str, default: str | None = None) -> str | None:
return self._store.get(plugin, {}).get(key, default)
def set(self, plugin: str, key: str, value: str) -> None:
self._store.setdefault(plugin, {})[key] = value
def delete(self, plugin: str, key: str) -> bool:
try:
del self._store[plugin][key]
return True
except KeyError:
return False
class _FakeBot:
"""Minimal bot stand-in."""
@@ -38,6 +58,7 @@ class _FakeBot:
self.joined: list[str] = []
self._admin = admin
self.conn = _FakeConn()
self.state = _FakeState()
def _is_admin(self, message) -> bool:
return self._admin