Fuehre die Pflicht-Suite gegen eine Wegwerfdatenbank und lege Nutzer als Betreiber an.
Deploy Development / deploy (push) Failing after 40s

Testdaten entstehen nur dort und werden danach entfernt, damit Dev und Produktion sie nicht behalten.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-16 23:09:28 +02:00
1 parent 528fc191e8
commit 4420790707
24 files changed
+1264 -26

No files matched your search

+15 -5
View File
@@ -13,19 +13,29 @@ def normalize_email(email: str) -> str:
return email.strip().lower()
def create_account(conn, email: str, display_name: str, password: str) -> dict:
def create_account(
conn,
email: str,
display_name: str,
password: str,
*,
is_superadmin: bool = False,
origin: str = "operator",
) -> dict:
email = normalize_email(email)
display_name = display_name.strip()
if origin not in {"operator", "fixture"}:
raise unprocessable("Die Kontenherkunft ist ungültig.")
if conn.execute("SELECT 1 FROM auth_accounts WHERE email = %s", (email,)).fetchone():
raise unprocessable("Für diese E-Mail gibt es bereits ein Konto.")
account_id = uuid4()
password_hash = hash_password(password)
conn.execute(
"""
INSERT INTO auth_accounts (id, email, display_name, password_hash)
VALUES (%s, %s, %s, %s)
INSERT INTO auth_accounts (id, email, display_name, password_hash, is_superadmin, origin)
VALUES (%s, %s, %s, %s, %s, %s)
""",
(account_id, email, display_name, password_hash),
(account_id, email, display_name, password_hash, is_superadmin, origin),
)
conn.execute(
"""
@@ -35,7 +45,7 @@ def create_account(conn, email: str, display_name: str, password: str) -> dict:
(account_id, account_id),
)
return conn.execute(
"SELECT id, email, display_name FROM auth_accounts WHERE id = %s",
"SELECT id, email, display_name, is_superadmin FROM auth_accounts WHERE id = %s",
(account_id,),
).fetchone()