Add conference detail pages and cached flight searches
This commit is contained in:
parent
6b253f2d04
commit
dcaf723336
24 changed files with 12198 additions and 12 deletions
|
|
@ -1,12 +1,14 @@
|
|||
"""Check automatic Geomob recording and failure notifications."""
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from datetime import date
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from agenda.geomob import GeomobEvent, geomob_email, record_event
|
||||
from agenda.geomob import GeomobEvent, conference_page_links, geomob_email, record_event
|
||||
|
||||
EVENT = GeomobEvent(date(2026, 10, 15), "/post/oct-2026", "#geomobLON")
|
||||
BASE_URL = "https://thegeomob.com"
|
||||
|
|
@ -87,3 +89,44 @@ def test_duplicate_event() -> None:
|
|||
assert "Already recorded" in record_event(EVENT, BASE_URL)
|
||||
assert run.call_count == 4
|
||||
assert run.call_args.args[0] == ["git", "push"]
|
||||
|
||||
|
||||
def test_email_keeps_event_url_and_adds_conference_page(tmp_path: Path) -> None:
|
||||
"""A saved event links to its canonical agenda page alongside the original URL."""
|
||||
event = GeomobEvent(
|
||||
date(2026, 10, 28), "/post/oct-28th-2026-geomobcgn-details", "#geomobCGN"
|
||||
)
|
||||
conference = {
|
||||
"name": "Geomob Cologne",
|
||||
"location": "Cologne",
|
||||
"country": "de",
|
||||
"dates": {"status": "exact", "start": event.date, "end": event.date},
|
||||
"url": BASE_URL + event.href,
|
||||
}
|
||||
(tmp_path / "conferences.yaml").write_text(yaml.safe_dump([conference]))
|
||||
links = conference_page_links([event], BASE_URL, str(tmp_path))
|
||||
expected = (
|
||||
"https://edwardbetts.com/agenda/conference/2026-10-28/geomob-cologne-cologne"
|
||||
)
|
||||
assert links == {event: expected}
|
||||
subject, body = geomob_email(
|
||||
[event], BASE_URL, {event: "Recorded and pushed."}, links
|
||||
)
|
||||
assert subject == "1 New Geomob Event(s) Announced"
|
||||
assert "URL: https://thegeomob.com/post/oct-28th-2026-geomobcgn-details" in body
|
||||
assert f"Conference page: {expected}" in body
|
||||
assert "Recording: Recorded and pushed." in body
|
||||
changed_date = GeomobEvent(date(2026, 10, 29), event.href, event.hashtag)
|
||||
assert conference_page_links([changed_date], BASE_URL, str(tmp_path)) == {}
|
||||
|
||||
|
||||
def test_missing_conference_data_does_not_hide_event(tmp_path: Path) -> None:
|
||||
"""Unrecorded events still generate their original notification without a broken link."""
|
||||
links = conference_page_links([EVENT], BASE_URL, str(tmp_path))
|
||||
assert links == {}
|
||||
_, body = geomob_email(
|
||||
[EVENT], BASE_URL, {EVENT: "FAILED at add conference"}, links
|
||||
)
|
||||
assert "URL: " + BASE_URL + EVENT.href in body
|
||||
assert "FAILED at add conference" in body
|
||||
assert "Conference page:" not in body
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue