"""Regression tests for GWR update notifications.""" from pathlib import Path from unittest.mock import Mock, patch import flask import pytest from update import update_gwr_advance_ticket_date @pytest.mark.parametrize( ("response_html", "expect_email"), [ ( "
We are sorry that we cannot show you the page you were looking for. " "Our website is extremely busy at the moment.
", False, ), ( "We are sorry that we cannot show you the page you were looking for.\n" "Our website is extremely busy at the moment.
", False, ), ("Unexpected response without booking dates.
", True), ], ids=["busy-page", "busy-page-whitespace", "unexpected-page"], ) def test_gwr_missing_dates_notifications( tmp_path: Path, response_html: str, expect_email: bool ) -> None: """Only known busy pages skip alerts; failed responses preserve the cache.""" cached_html = """| Weekdays | Friday 25 December 2026 |
| Saturdays | Saturday 26 December 2026 |
| Sundays | Sunday 27 December 2026 |