add initial test cases for status page functionality
This commit is contained in:
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"python.testing.pytestArgs": [
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"python.testing.unittestEnabled": false,
|
||||||
|
"python.testing.pytestEnabled": true
|
||||||
|
}
|
||||||
5
pytest.ini
Normal file
5
pytest.ini
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[pytest]
|
||||||
|
minversion = 7.0
|
||||||
|
addopts = -ra
|
||||||
|
testpaths = tests
|
||||||
|
python_files = test_*.py
|
||||||
1937
sample_html/status_in_produktion.html
Normal file
1937
sample_html/status_in_produktion.html
Normal file
File diff suppressed because it is too large
Load Diff
23
tests/test_statuspage.py
Normal file
23
tests/test_statuspage.py
Normal 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)
|
||||||
Reference in New Issue
Block a user