add initial test cases for status page functionality

This commit is contained in:
2026-02-03 01:12:06 +01:00
parent 7367226210
commit 10d1201799
4 changed files with 1972 additions and 0 deletions

7
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}

5
pytest.ini Normal file
View File

@@ -0,0 +1,5 @@
[pytest]
minversion = 7.0
addopts = -ra
testpaths = tests
python_files = test_*.py

File diff suppressed because it is too large Load Diff

23
tests/test_statuspage.py Normal file
View File

@@ -0,0 +1,23 @@
from datetime import datetime
from main import is_status_page, parse_status_page, normalize_status_text
SAMPLE_HTML = "sample_html/status_in_produktion.html"
def test_is_status_page_positive():
with open(SAMPLE_HTML, encoding="utf-8") as fh:
html = fh.read()
assert is_status_page(html) is True
def test_parse_status_page_positive():
with open(SAMPLE_HTML, encoding="utf-8") as fh:
html = fh.read()
status_raw, timestamp = parse_status_page(html)
status = normalize_status_text(status_raw)
assert status == "noch in Produktion"
assert timestamp == datetime(2026, 2, 2, 16, 0, 0)