Compare commits

...

1 Commits

Author SHA1 Message Date
Barcode Betty ea4e53b4f4 Fix test failures: generate unique email_inbound_token in test fixtures
CI / lint (pull_request) Failing after 3s
CI / typecheck (pull_request) Failing after 18s
CI / test (pull_request) Failing after 1m29s
CI / build-and-push (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
UNIQUE constraint on users.email_inbound_token was violated in tests because
manual INSERT statements omitted the column. All three sites that create test
users via raw SQL now explicitly generate a unique token via secrets.token_urlsafe(16).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-23 22:38:29 +00:00
3 changed files with 9 additions and 6 deletions
+3 -2
View File
@@ -177,8 +177,8 @@ async def _create_test_user_and_session(
async with db_engine.begin() as conn: async with db_engine.begin() as conn:
await conn.execute( await conn.execute(
text( text(
"INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) " "INSERT INTO users (id, email, hashed_password, display_name, email_verified, email_inbound_token, created_at, updated_at) "
"VALUES (:id, :email, :hashed_password, :display_name, :email_verified, :created_at, :updated_at)" "VALUES (:id, :email, :hashed_password, :display_name, :email_verified, :email_inbound_token, :created_at, :updated_at)"
), ),
{ {
"id": user_id, "id": user_id,
@@ -186,6 +186,7 @@ async def _create_test_user_and_session(
"hashed_password": "not-used-with-better-auth", "hashed_password": "not-used-with-better-auth",
"display_name": display_name, "display_name": display_name,
"email_verified": False, "email_verified": False,
"email_inbound_token": secrets.token_urlsafe(16),
"created_at": now, "created_at": now,
"updated_at": now, "updated_at": now,
}, },
+3 -2
View File
@@ -138,8 +138,8 @@ async def test_expired_session_rejected(client, db_engine):
async with db_engine.begin() as conn: async with db_engine.begin() as conn:
await conn.execute( await conn.execute(
text( text(
"INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) " "INSERT INTO users (id, email, hashed_password, display_name, email_verified, email_inbound_token, created_at, updated_at) "
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)" "VALUES (:id, :email, :hp, :dn, :ev, :token, :ca, :ua)"
), ),
{ {
"id": user_id, "id": user_id,
@@ -147,6 +147,7 @@ async def test_expired_session_rejected(client, db_engine):
"hp": "unused", "hp": "unused",
"dn": "Expired User", "dn": "Expired User",
"ev": False, "ev": False,
"token": secrets.token_urlsafe(16),
"ca": now, "ca": now,
"ua": now, "ua": now,
}, },
+3 -2
View File
@@ -65,8 +65,8 @@ class TestSessionValidation:
async with db_engine.begin() as conn: async with db_engine.begin() as conn:
await conn.execute( await conn.execute(
text( text(
"INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) " "INSERT INTO users (id, email, hashed_password, display_name, email_verified, email_inbound_token, created_at, updated_at) "
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)" "VALUES (:id, :email, :hp, :dn, :ev, :token, :ca, :ua)"
), ),
{ {
"id": user_id, "id": user_id,
@@ -74,6 +74,7 @@ class TestSessionValidation:
"hp": "unused", "hp": "unused",
"dn": "Expired User", "dn": "Expired User",
"ev": False, "ev": False,
"token": secrets.token_urlsafe(16),
"ca": now, "ca": now,
"ua": now, "ua": now,
}, },