Archived
Update visible examples with visitor IP
This commit is contained in:
1 parent
8de260dfc7
commit
03ef2d9af6
6 files changed
+67
-2
No files matched your search
@@ -552,6 +552,7 @@ def test_application_pages_use_stricter_script_csp(tmp_path: Path) -> None:
|
||||
assert response.status_code == 200
|
||||
assert '<script src="/theme.js?v=2"></script>' in response.text
|
||||
assert '<script src="/clipboard.js?v=3" defer></script>' in response.text
|
||||
assert '<script src="/visitor-ip.js?v=1" defer></script>' in response.text
|
||||
assert '<script src="/admin-tables.js?v=2" defer></script>' not in response.text
|
||||
assert '<link href="/bootstrap-subset.css?v=3" rel="stylesheet">' in response.text
|
||||
assert '<link href="/app.css?v=13" rel="stylesheet">' in response.text
|
||||
@@ -560,6 +561,7 @@ def test_application_pages_use_stricter_script_csp(tmp_path: Path) -> None:
|
||||
assert "<style>" not in response.text
|
||||
assert "script-src 'self' 'unsafe-inline'" in response.headers["content-security-policy"]
|
||||
assert "style-src 'self'" in response.headers["content-security-policy"]
|
||||
assert "connect-src 'self' https://api4.ipify.org https://api6.ipify.org" in response.headers["content-security-policy"]
|
||||
assert "style-src 'self' 'unsafe-inline'" not in response.headers["content-security-policy"]
|
||||
bootstrap_css = client.get("/bootstrap-subset.css")
|
||||
assert bootstrap_css.status_code == 200
|
||||
@@ -567,6 +569,10 @@ def test_application_pages_use_stricter_script_csp(tmp_path: Path) -> None:
|
||||
assert bootstrap_css.headers["cache-control"] == "public, max-age=31536000, immutable"
|
||||
assert client.get("/theme.js").status_code == 200
|
||||
assert client.get("/clipboard.js").status_code == 200
|
||||
visitor_ip_js = client.get("/visitor-ip.js")
|
||||
assert visitor_ip_js.status_code == 200
|
||||
assert "api4.ipify.org" in visitor_ip_js.text
|
||||
assert "api6.ipify.org" in visitor_ip_js.text
|
||||
assert client.get("/admin-tables.js").status_code == 200
|
||||
app_css = client.get("/app.css")
|
||||
assert app_css.status_code == 200
|
||||
|
||||
Reference in new issue
Block a user