33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
from datetime import datetime, timezone
|
|
from chorus_bot import ping
|
|
|
|
|
|
def test_build_and_parse_round_trip():
|
|
captured_at = datetime(2026, 7, 13, 7, 0, 0, tzinfo=timezone.utc)
|
|
embed = ping.build_ping_embed(
|
|
modality="bh_email",
|
|
sender_id="jane@example.com",
|
|
snippet="I have some books to donate...",
|
|
raw_content="I have some books to donate. Full text goes here.",
|
|
captured_at=captured_at,
|
|
)
|
|
assert "bh_email" in embed.title or "bh_email" in str(embed.fields)
|
|
assert "I have some books to donate..." in (embed.description or "")
|
|
|
|
parsed = ping.parse_ping_embed(embed)
|
|
assert parsed["modality"] == "bh_email"
|
|
assert parsed["sender_id"] == "jane@example.com"
|
|
assert parsed["raw_content"] == "I have some books to donate. Full text goes here."
|
|
assert parsed["captured_at"] == captured_at
|
|
|
|
|
|
def test_build_ping_embed_handles_missing_sender():
|
|
embed = ping.build_ping_embed(
|
|
modality="voice",
|
|
sender_id=None,
|
|
snippet="call about donation",
|
|
raw_content="call about donation",
|
|
captured_at=datetime(2026, 7, 13, 8, 0, 0, tzinfo=timezone.utc),
|
|
)
|
|
parsed = ping.parse_ping_embed(embed)
|
|
assert parsed["sender_id"] is None
|