Files
checkbot/tests/test_commands_ai.py
T
patrickandClaude Sonnet 5.5 cdcf7f673a
test / pytest (3.11) (push) Waiting to run
test / pytest (3.13) (push) Waiting to run
fix: Härtung nach Referenz-Review, Phase-6d-Fallbacks vermerkt
Telegram: Plain-Text-Fallback bei Parse-Fehler, tag-sichere Kürzung auf 4096.
Matrix: bytebewusste Kürzung. Downtime: lesender Abgleich nach dem POST,
generische Fehlermeldung im Chat. Agent: Platzhalter für nicht ausgeführte
Tool-Calls, Text im letzten Schritt erzwingen, Zeitreserve, Kompaktierung,
Limit pro Antwort. CLAUDE.md: Fallbacks für Phase 6d.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 11:58:54 +01:00

23 lines
687 B
Python

from app.agent import AgentResult
from app.commands.ai import agent_reply
def test_agent_reply_escapes_html():
result = AgentResult("CPU & RAM <hoch>", ())
reply = agent_reply(result)
assert reply.text == "CPU & RAM <hoch>"
assert reply.html == "CPU &amp; RAM &lt;hoch&gt;"
def test_agent_reply_escaped_length_stays_within_limit():
result = AgentResult("&" * 3000, ())
reply = agent_reply(result)
assert len(reply.html) <= 3000
assert reply.html == "&amp;" * (len(reply.html) // 5)
def test_agent_reply_plain_text_truncated_to_answer_max():
result = AgentResult("x" * 4000, ())
reply = agent_reply(result)
assert len(reply.text) == 3000