Mirror test layout, domcontentloaded waits, backup DB writes outside threads

This commit is contained in:
2026-10-05 09:41:22 +02:00
parent 8f6c5be314
commit 622795c9a0
46 changed files with 296 additions and 241 deletions
+1
View File
@@ -0,0 +1 @@
# retoor <retoor@molodetz.nl>
+24
View File
@@ -0,0 +1,24 @@
# retoor <retoor@molodetz.nl>
from tests.conftest import ADMIN_PASSWORD, ADMIN_USERNAME
def test_login_wrong_password(anon):
response = anon.post("/auth/login", data={"username": ADMIN_USERNAME, "password": "verkeerd-wachtwoord"})
assert response.status_code in (400, 401, 200)
assert "session" not in "".join(response.cookies.keys()).lower() or response.status_code != 302
def test_login_and_logout(anon):
response = anon.post("/auth/login", data={"username": ADMIN_USERNAME, "password": ADMIN_PASSWORD})
assert response.status_code in (302, 303)
assert anon.get("/admin").status_code == 200
cookie = response.headers.get("set-cookie", "").lower()
assert "httponly" in cookie and "samesite=lax" in cookie
assert anon.post("/auth/logout").status_code in (302, 303)
assert anon.get("/admin").status_code in (302, 303, 401)
def test_admin_redirects_anonymous(anon):
response = anon.get("/admin")
assert response.status_code in (302, 303)
assert "/auth/login" in response.headers["location"]