Fuehre die Pflicht-Suite gegen eine Wegwerfdatenbank und lege Nutzer als Betreiber an.
Deploy Development / deploy (push) Failing after 40s
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:
1 parent
528fc191e8
commit
4420790707
24 files changed
+1264
-26
No files matched your search
+9
-5
@@ -1,4 +1,4 @@
|
||||
"""Synthetic development accounts and a rental matter. Never runs in production."""
|
||||
"""Synthetic rental case for the ephemeral test database. Never persists on dev or prod."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -47,8 +47,12 @@ trailer<</Root 1 0 R>>
|
||||
"""
|
||||
|
||||
|
||||
def demo_allowed(settings: Settings) -> bool:
|
||||
return settings.tsumugu_env == "development" and settings.db_name == "tsumugu_pytest" and settings.seed_demo
|
||||
|
||||
|
||||
def demo_public(settings: Settings) -> dict:
|
||||
if settings.tsumugu_env != "development" or not settings.seed_demo:
|
||||
if not demo_allowed(settings):
|
||||
raise not_found()
|
||||
return {
|
||||
"accounts": [
|
||||
@@ -60,15 +64,15 @@ def demo_public(settings: Settings) -> dict:
|
||||
|
||||
def seed_demo(settings: Settings | None = None) -> bool:
|
||||
settings = settings or get_settings()
|
||||
if settings.tsumugu_env != "development" or not settings.seed_demo:
|
||||
if not demo_allowed(settings):
|
||||
return False
|
||||
cleanup: list[Path] = []
|
||||
with psycopg.connect(settings.dsn(), row_factory=dict_row) as conn:
|
||||
try:
|
||||
if conn.execute("SELECT 1 FROM auth_accounts WHERE email = %s", (ADA_EMAIL,)).fetchone():
|
||||
return False
|
||||
ada = create_account(conn, ADA_EMAIL, "Ada Beispiel", ADA_PASSWORD)
|
||||
ben = create_account(conn, BEN_EMAIL, "Ben Beispiel", BEN_PASSWORD)
|
||||
ada = create_account(conn, ADA_EMAIL, "Ada Beispiel", ADA_PASSWORD, origin="fixture")
|
||||
ben = create_account(conn, BEN_EMAIL, "Ben Beispiel", BEN_PASSWORD, origin="fixture")
|
||||
room = conn.execute(
|
||||
"""
|
||||
INSERT INTO data_rooms (id, kind, name, created_by)
|
||||
|
||||
Reference in new issue
Block a user