18 lines
699 B
Python
18 lines
699 B
Python
"""Schriften kommen vom eigenen Server (CSP default-src 'self'), nicht von Google."""
|
|
|
|
import re
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
def test_schriften_lokal_eingebunden(app):
|
|
with TestClient(app) as client:
|
|
page = client.get("/login").text
|
|
css_url = re.search(r'href="([^"]*/css/fonts\.css[^"]*)"', page).group(1)
|
|
css = client.get(css_url).text
|
|
assert "googleapis" not in page + css
|
|
files = re.findall(r'url\("\.\./fonts/([^"]+)"\)', css)
|
|
assert len(files) == 4
|
|
for name in files:
|
|
response = client.get(f"/static/fonts/{name}")
|
|
assert response.status_code == 200 and response.content[:4] == b"wOF2", name
|