test: add disabled-state and no-audio-hosting tests for podcast link (#474)

* test: add disabled-state and no-audio-hosting tests for podcast link Add acceptance criteria tests for issue #307: - Verify podcast link is safely disabled when URL is empty/whitespace - Verify no audio hosting, embed players, or podcast RSS in templates Closes #307 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: address review comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Juan Manuel Servera committed Jun 14, 2026 at 10:23 UTC 55f46abfcd61fd2842d5b5e638c56eded28bcd03
1 file changed +35
tests/test_podcast_link.py
+35
@@ -50,3 +50,38 @@ def test_header_exposes_spotify_button_when_podcast_url_is_configured() -> None:
50 r'<a\s+class="icon-button spotify-button"\s+href="{{\s*\.\s*\|\s*safeURL\s*}}"[^>]*target="_blank"[^>]*rel="noopener noreferrer"[^>]*aria-label="Spotify"',
51 header,
52 ), "Header Spotify button must use configured URL with target=_blank and rel=noopener noreferrer"
53 +
54 +
55 +def test_podcast_link_disabled_when_empty() -> None:
56 + """Templates must guard against empty/whitespace podcast_url (disabled state)."""
57 + footer = (REPO_ROOT / "layouts" / "partials" / "footer.html").read_text(encoding="utf-8")
58 + header = (REPO_ROOT / "layouts" / "partials" / "header.html").read_text(encoding="utf-8")
59 + shortcuts = (REPO_ROOT / "layouts" / "partials" / "report-shortcuts.html").read_text(encoding="utf-8")
60 + assert "{{- with site.Params.podcast_url | strings.TrimSpace }}" in footer, (
61 + "Footer must render the podcast link only through a trimmed `with` guard"
62 + )
63 + assert '{{- $podcastURL := site.Params.podcast_url | default "" | strings.TrimSpace }}' in header, (
64 + "Header must normalize podcast_url into $podcastURL before rendering"
65 + )
66 + assert "{{- with $podcastURL }}" in header, (
67 + "Header must guard the Spotify button with `with $podcastURL`"
68 + )
69 + assert "{{- if and $isWeekly $podcastURL }}" in shortcuts, (
70 + "Weekly shortcuts must require a non-empty $podcastURL before rendering Spotify"
71 + )
72 +
73 +
74 +def test_no_audio_hosting_or_player_pages() -> None:
75 + """SquadScope must not host audio, embed players, or serve podcast RSS."""
76 + layouts_dir = REPO_ROOT / "layouts"
77 + # No podcast RSS template
78 + for f in layouts_dir.rglob("*.xml"):
79 + content = f.read_text(encoding="utf-8").lower()
80 + assert "<enclosure" not in content, f"{f.name} must not contain podcast RSS enclosure tags"
81 + assert "open.spotify.com/embed" not in content, f"{f.name} must not embed Spotify players"
82 + # No audio player templates
83 + for f in layouts_dir.rglob("*.html"):
84 + content = f.read_text(encoding="utf-8").lower()
85 + assert "<audio" not in content, f"{f.name} must not contain audio player elements"
86 + assert "open.spotify.com/embed" not in content, f"{f.name} must not embed Spotify players"
87 + assert "spotify:embed:" not in content, f"{f.name} must not contain Spotify embed URIs"