fix: isolate GTIN tool and legal pages
This commit is contained in:
@@ -28,6 +28,8 @@ from content import CONTACT, LEGAL, SITE as META # noqa: E402
|
||||
ROUTE_PATHS = [route[0] for route in pages.ROUTES]
|
||||
HTML_FILES = [SITE / route[1] for route in pages.ROUTES] + [SITE / "404.html"]
|
||||
GTIN_HTML = SITE / "gtin" / "index.html"
|
||||
GTIN_IMPRESSUM = SITE / "gtin" / "impressum" / "index.html"
|
||||
GTIN_DATENSCHUTZ = SITE / "gtin" / "datenschutz" / "index.html"
|
||||
|
||||
|
||||
def read(path: Path) -> str:
|
||||
@@ -49,7 +51,12 @@ class BuildLayout(unittest.TestCase):
|
||||
self.assertTrue((SITE / rel).is_file(), f"missing {rel}")
|
||||
|
||||
def test_no_stray_html_files(self):
|
||||
expected = {route[1] for route in pages.ROUTES} | {"404.html", "gtin/index.html"}
|
||||
expected = {route[1] for route in pages.ROUTES} | {
|
||||
"404.html",
|
||||
"gtin/index.html",
|
||||
"gtin/impressum/index.html",
|
||||
"gtin/datenschutz/index.html",
|
||||
}
|
||||
actual = {str(f.relative_to(SITE)) for f in SITE.rglob("*.html")}
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
@@ -215,9 +222,6 @@ class PrivacyAndLegal(unittest.TestCase):
|
||||
for needle in (
|
||||
"keine Zugriffsprotokolle",
|
||||
"keine Cookies",
|
||||
"GTIN-Tool",
|
||||
"bis zu 20",
|
||||
"nicht an einen Server übertragen",
|
||||
"youtube-nocookie.com",
|
||||
"Art. 6 Abs. 1 lit. f DSGVO",
|
||||
LEGAL["authority"],
|
||||
@@ -323,13 +327,52 @@ class Content(unittest.TestCase):
|
||||
self.assertIn("GTIN Generator", text)
|
||||
self.assertIn('<link rel="canonical" href="https://desfoto.de/gtin/" />', text)
|
||||
self.assertIn('<meta name="robots" content="noindex, nofollow" />', text)
|
||||
self.assertIn('href="/impressum/"', text)
|
||||
self.assertIn('href="/datenschutz/"', text)
|
||||
self.assertIn('href="/gtin/impressum/"', text)
|
||||
self.assertIn('href="/gtin/datenschutz/"', text)
|
||||
self.assertEqual(len(re.findall(r'<a href="/gtin/datenschutz/">', text)), 1)
|
||||
self.assertNotIn('href="/impressum/"', text)
|
||||
self.assertNotIn('href="/datenschutz/"', text)
|
||||
self.assertNotIn('href="/"', text)
|
||||
self.assertNotIn("/gtin/", read(SITE / "sitemap.xml"))
|
||||
for file in HTML_FILES:
|
||||
with self.subTest(file=str(file.relative_to(SITE))):
|
||||
self.assertNotIn("/gtin", read(file))
|
||||
self.assertNotIn("GTIN", read(file))
|
||||
|
||||
def test_gtin_legal_pages_are_standalone_and_unlisted(self):
|
||||
impressum = read(GTIN_IMPRESSUM)
|
||||
datenschutz = read(GTIN_DATENSCHUTZ)
|
||||
for path, text in (
|
||||
("/gtin/impressum/", impressum),
|
||||
("/gtin/datenschutz/", datenschutz),
|
||||
):
|
||||
with self.subTest(path=path):
|
||||
self.assertIn(f'<link rel="canonical" href="https://desfoto.de{path}" />', text)
|
||||
self.assertIn('<meta name="robots" content="noindex, nofollow" />', text)
|
||||
self.assertNotIn('href="/impressum/"', text)
|
||||
self.assertNotIn('href="/datenschutz/"', text)
|
||||
self.assertNotIn('href="/"', text)
|
||||
self.assertNotIn("assets/", text)
|
||||
for value in (
|
||||
LEGAL["business"], LEGAL["owner"], LEGAL["street"], LEGAL["city"],
|
||||
CONTACT["email"], CONTACT["phone"], "§ 5 DDG", LEGAL["w_id"],
|
||||
):
|
||||
with self.subTest(impressum=value):
|
||||
self.assertIn(value, visible_text(impressum))
|
||||
for value in (
|
||||
LEGAL["owner"], CONTACT["email"], "bis zu 20", "Cache API",
|
||||
"nicht an einen Server übertragen", "keine Cookies", "Art. 6 Abs. 1 lit. f DSGVO",
|
||||
LEGAL["authority"],
|
||||
):
|
||||
with self.subTest(datenschutz=value):
|
||||
self.assertIn(value, visible_text(datenschutz))
|
||||
self.assertIn('href="/gtin/datenschutz/"', impressum)
|
||||
self.assertIn('href="/gtin/impressum/"', datenschutz)
|
||||
|
||||
def test_main_legal_pages_do_not_name_the_gtin_tool(self):
|
||||
for path in (SITE / "impressum" / "index.html", SITE / "datenschutz" / "index.html"):
|
||||
with self.subTest(path=str(path.relative_to(SITE))):
|
||||
self.assertNotIn("GTIN", visible_text(read(path)))
|
||||
|
||||
def test_gtin_assets_and_local_data_storage_are_scoped(self):
|
||||
html_text = read(GTIN_HTML)
|
||||
|
||||
Reference in New Issue
Block a user