feat: komplette Site — 19 Routen, 24 Artikel, Leistungen, IT-Service, FAQ, Kontakt, CRM-Formular
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
"""IT-Hilfe-Sofort.de — alle 19 Sitemap-Routen."""
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
project_root = Path(__file__).resolve().parent.parent
|
||||
|
||||
import app # noqa: E402
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
"""Flask-Test-Client."""
|
||||
app.app.config["TESTING"] = True
|
||||
with app.app.test_client() as klient:
|
||||
yield klient
|
||||
|
||||
|
||||
SEITEN = [
|
||||
("/", "Startseite"),
|
||||
("/impressum", "Impressum"),
|
||||
("/datenschutz", "Datenschutz"),
|
||||
("/ueber-uns", "Ueber uns"),
|
||||
("/kontakt", "Kontakt"),
|
||||
("/faq", "FAQ"),
|
||||
("/blog/telematik-vorschriften", "Telematik-Vorschriften"),
|
||||
("/blog/dsgvo-it-sicherheit", "DSGVO & IT-Sicherheit"),
|
||||
("/blog/fachkraeftemangel", "Fachkraeftemangel"),
|
||||
("/blog/foerderung-finanzierung", "Foerderung & Finanzierung"),
|
||||
("/blog/qualitaet-pruefung", "Qualitaet & Pruefung"),
|
||||
("/blog/praxis-tipps", "Praxis-Tipps"),
|
||||
("/leistungen/pflegedienste", "Pflegedienste"),
|
||||
("/leistungen/pflegeheime", "Pflegeheime"),
|
||||
("/leistungen/tagespflegen", "Tagespflegen"),
|
||||
("/it-service/hardware", "Hardware"),
|
||||
("/it-service/netzwerk", "Netzwerk"),
|
||||
("/it-service/email-kommunikation", "E-Mail & Kommunikation"),
|
||||
("/it-service/support-wartung", "Support & Wartung"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("pfad,titel", SEITEN)
|
||||
def test_seite_ist_erreichbar(pfad: str, titel: str, client) -> None:
|
||||
"""Jede Sitemap-Seite muss mit 200 antworten."""
|
||||
response = client.get(pfad)
|
||||
assert response.status_code == 200, f"{pfad} ({titel}) gab {response.status_code}"
|
||||
assert b"<!DOCTYPE html>" in response.data, f"{pfad} hat kein valid HTML"
|
||||
|
||||
|
||||
def test_base_template_inhalt(client) -> None:
|
||||
"""Das base_template muss Header, Footer und CSS enthalten."""
|
||||
response = client.get("/")
|
||||
assert b"site-header" in response.data
|
||||
assert b"site-footer" in response.data
|
||||
assert b"IT-Hilfe-Sofort.de" in response.data
|
||||
|
||||
|
||||
def test_kontakt_iframe_present(client) -> None:
|
||||
"""Das Kontakt-Formular muss das CRM iframe enthalten."""
|
||||
response = client.get("/kontakt")
|
||||
assert b"crm.companyhub.io" in response.data
|
||||
|
||||
|
||||
def test_faq_accordion_present(client) -> None:
|
||||
"""FAQ muss Aufklappbare Elemente enthalten."""
|
||||
response = client.get("/faq")
|
||||
assert b"faq-item" in response.data
|
||||
assert b"summary" in response.data
|
||||
|
||||
|
||||
def test_404_fuer_unbekannte_seiten(client) -> None:
|
||||
"""Unbekannte URLs muessen 404 liefern."""
|
||||
response = client.get("/nicht-existiert")
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
def test_artikel_dateien_existieren() -> None:
|
||||
"""Alle 24 Artikel-Htmls muessen im 'artikel'-Ordner liegen."""
|
||||
artikel_dir = project_root
|
||||
zaehler = 0
|
||||
for f in artikel_dir.glob("artikel-*.html"):
|
||||
zaehler += 1
|
||||
assert zaehler == 24, f"Erwartet 24 Artikel, gefunden {zaehler}"
|
||||
Reference in New Issue
Block a user