Mirror test layout, domcontentloaded waits, backup DB writes outside threads
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
PUBLIC_PAGES = ["/", "/rol", "/standaard", "/flyers", "/memes", "/mensen", "/mensen/retoor", "/binnen", "/docs", "/docs/welkom", "/docs/api/inhoud", "/docs/search?q=markdown", "/voorwaarden", "/privacy", "/auth/login"]
|
||||
JSON_PAGES = ["/", "/rol", "/standaard", "/flyers", "/memes", "/mensen", "/binnen"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", PUBLIC_PAGES)
|
||||
def test_public_pages_return_200(anon, path):
|
||||
response = anon.get(path)
|
||||
assert response.status_code == 200, path
|
||||
assert "text/html" in response.headers["content-type"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", JSON_PAGES)
|
||||
def test_json_faces(anon, path):
|
||||
response = anon.get(path, headers={"Accept": "application/json"})
|
||||
assert response.status_code == 200
|
||||
assert response.headers["content-type"].startswith("application/json")
|
||||
assert isinstance(response.json(), dict)
|
||||
|
||||
|
||||
def test_no_bare_static_urls_in_rendered_html(anon):
|
||||
for path in ("/", "/flyers", "/memes", "/rol"):
|
||||
html = anon.get(path).text
|
||||
assert not re.search(r"""(src|href)="/static/(?!v|uploads/)""", html), path
|
||||
|
||||
|
||||
def test_versioned_static_asset(anon):
|
||||
html = anon.get("/").text
|
||||
match = re.search(r'href="(/static/v[^"]+/css/base\.css)"', html)
|
||||
assert match
|
||||
assert anon.get(match.group(1)).status_code == 200
|
||||
Reference in New Issue
Block a user