fix(P1-4): Status-Farben und Flughafen-Prinzip in ::hilfe und ::status

This commit is contained in:
Bernd (Hermes)
2026-07-24 05:08:43 +02:00
parent 573335cc8d
commit d964d7d5b5
3 changed files with 212 additions and 1 deletions
@@ -1092,3 +1092,142 @@ class TestCommandHandlersMocked:
assert handler is not None
result = await handler("room1", "")
assert "hermes update" in result
# ═══════════════════════════════════════════════════════════════════════════
# P1-4: Status-Farben in ::hilfe und ::status
# ═══════════════════════════════════════════════════════════════════════════
class TestHelpTextPresenceColors:
"""P1-4: build_help_text zeigt Status-Farben-Sektion wenn presence_enabled."""
def test_help_text_includes_status_colors_when_presence_enabled(self):
"""presence_enabled=True → 'Status-Farben' Sektion erscheint."""
from archivar.inline_commands import InlineCommandRegistry, build_help_text
registry = InlineCommandRegistry()
text = build_help_text(registry, presence_enabled=True, current_status="online")
assert "Status-Farben" in text, (
f"Status-Farben Sektion fehlt:\n{text}"
)
assert "online" in text
assert "away" in text
assert "busy" in text
# Flughafen-Prinzip erklärt
assert "flughafen" in text.lower() or "ampel" in text.lower(), (
f"Flughafen-Prinzip nicht erklärt:\n{text}"
)
def test_help_text_no_status_colors_when_presence_disabled(self):
"""presence_enabled=False → keine Status-Farben Sektion."""
from archivar.inline_commands import InlineCommandRegistry, build_help_text
registry = InlineCommandRegistry()
text = build_help_text(registry, presence_enabled=False)
assert "Status-Farben" not in text, (
f"Status-Farben Sektion sollte nicht erscheinen:\n{text}"
)
def test_help_text_no_status_colors_when_presence_none(self):
"""presence_enabled=None (default) → keine Status-Farben Sektion."""
from archivar.inline_commands import InlineCommandRegistry, build_help_text
registry = InlineCommandRegistry()
text = build_help_text(registry)
assert "Status-Farben" not in text
class TestStatusTextPresenceInfo:
"""P1-4: build_status_text zeigt PresenceEngine-Info wenn presence_enabled."""
def test_status_text_includes_presence_info_when_enabled(self):
"""presence_enabled=True → PresenceEngine + Status + Pulse Zeilen."""
from archivar.inline_commands import build_status_text
text = build_status_text(
room_count=3,
archivar_active=True,
butler_mode="cognitive",
presence_enabled=True,
current_status="online",
pulse_active=True,
)
assert "PresenceEngine" in text, (
f"PresenceEngine-Zeile fehlt:\n{text}"
)
assert "Aktiv" in text # ✅ Aktiv
assert "online" in text, (
f"Aktueller Status fehlt:\n{text}"
)
assert "aktiv" in text.lower(), (
f"Pulse-Info fehlt:\n{text}"
)
def test_status_text_includes_presence_info_when_disabled(self):
"""presence_enabled=False → PresenceEngine ❌ Inaktiv."""
from archivar.inline_commands import build_status_text
text = build_status_text(
room_count=0,
archivar_active=False,
butler_mode="off",
presence_enabled=False,
current_status="online",
pulse_active=False,
)
assert "PresenceEngine" in text
assert "Inaktiv" in text
def test_status_text_no_presence_info_when_default(self):
"""presence_enabled=False (default) → keine PresenceEngine-Zeile."""
from archivar.inline_commands import build_status_text
text = build_status_text(
room_count=1,
archivar_active=True,
butler_mode="strict",
)
assert "PresenceEngine" not in text, (
f"PresenceEngine sollte nicht erscheinen (default):\n{text}"
)
def test_status_text_shows_away_status(self):
"""current_status='away' → 🟡 away im Status-Text."""
from archivar.inline_commands import build_status_text
text = build_status_text(
room_count=2,
archivar_active=True,
butler_mode="cognitive",
presence_enabled=True,
current_status="away",
pulse_active=True,
)
assert "away" in text, (
f"away-Status fehlt:\n{text}"
)
def test_status_text_shows_busy_status(self):
"""current_status='busy' → 🔴 busy im Status-Text."""
from archivar.inline_commands import build_status_text
text = build_status_text(
room_count=2,
archivar_active=True,
butler_mode="cognitive",
presence_enabled=True,
current_status="busy",
pulse_active=False,
)
assert "busy" in text, (
f"busy-Status fehlt:\n{text}"
)