Add conference series pages
This commit is contained in:
parent
098c7e4447
commit
57b2db205d
9 changed files with 367 additions and 3 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from datetime import date
|
||||
import typing
|
||||
from types import SimpleNamespace
|
||||
|
||||
import yaml
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ def test_build_conference_list_supports_inexact_dates(
|
|||
conferences = [
|
||||
{
|
||||
"name": "PyCascades 2027",
|
||||
"series": "pycascades",
|
||||
"topic": "Python",
|
||||
"location": "TBC",
|
||||
"dates": {
|
||||
|
|
@ -40,6 +42,19 @@ def test_build_conference_list_supports_inexact_dates(
|
|||
(tmp_path / "conferences.yaml").write_text(
|
||||
yaml.safe_dump(conferences), encoding="utf-8"
|
||||
)
|
||||
(tmp_path / "conference_series.yaml").write_text(
|
||||
yaml.safe_dump(
|
||||
{
|
||||
"pycascades": {
|
||||
"name": "PyCascades",
|
||||
"topic": "Python",
|
||||
"cadence": "annual",
|
||||
"url": "https://pycascades.com/",
|
||||
}
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
monkeypatch.setitem(web_view.app.config, "PERSONAL_DATA", str(tmp_path))
|
||||
monkeypatch.setattr(agenda.trip, "build_trip_list", lambda: [])
|
||||
|
|
@ -53,3 +68,55 @@ def test_build_conference_list_supports_inexact_dates(
|
|||
assert items[1]["date_status"] == "approximate"
|
||||
assert items[1]["display_date"] == "March 2027"
|
||||
assert items[1]["latest_date"] == date(2027, 3, 31)
|
||||
assert items[1]["series_detail"]["name"] == "PyCascades"
|
||||
|
||||
|
||||
def test_conference_series_pages(tmp_path: typing.Any, monkeypatch: typing.Any) -> None:
|
||||
"""Series index and detail pages should render linked conferences."""
|
||||
conferences = [
|
||||
{
|
||||
"name": "PyCascades 2027",
|
||||
"series": "pycascades",
|
||||
"topic": "Python",
|
||||
"location": "TBC",
|
||||
"trip": date(2027, 3, 1),
|
||||
"dates": {
|
||||
"status": "exact",
|
||||
"start": date(2027, 3, 5),
|
||||
"end": date(2027, 3, 6),
|
||||
},
|
||||
"going": True,
|
||||
}
|
||||
]
|
||||
series = {
|
||||
"pycascades": {
|
||||
"name": "PyCascades",
|
||||
"topic": "Python",
|
||||
"cadence": "annual",
|
||||
"url": "https://pycascades.com/",
|
||||
}
|
||||
}
|
||||
(tmp_path / "conferences.yaml").write_text(
|
||||
yaml.safe_dump(conferences), encoding="utf-8"
|
||||
)
|
||||
(tmp_path / "conference_series.yaml").write_text(
|
||||
yaml.safe_dump(series), encoding="utf-8"
|
||||
)
|
||||
|
||||
monkeypatch.setitem(web_view.app.config, "PERSONAL_DATA", str(tmp_path))
|
||||
fake_trip = SimpleNamespace(
|
||||
start=date(2027, 3, 1),
|
||||
title="Seattle Python trip",
|
||||
conferences=[{"start": date(2027, 3, 5), "name": "PyCascades 2027"}],
|
||||
)
|
||||
monkeypatch.setattr(agenda.trip, "build_trip_list", lambda: [fake_trip])
|
||||
|
||||
web_view.app.config["TESTING"] = True
|
||||
with web_view.app.test_client() as client:
|
||||
index_response = client.get("/conference/series")
|
||||
detail_response = client.get("/conference/series/pycascades")
|
||||
|
||||
assert index_response.status_code == 200
|
||||
assert b"PyCascades" in index_response.data
|
||||
assert detail_response.status_code == 200
|
||||
assert b"trip: Seattle Python trip" in detail_response.data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue