Skip to content

Commit 7b19595

Browse files
committed
Fix test base models and non-nullable integrity test
1 parent 4463b15 commit 7b19595

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UserCreate(models.BaseUserCreate):
1313
first_name: Optional[str]
1414

1515

16-
class UserUpdate(User, models.BaseUserUpdate):
16+
class UserUpdate(models.BaseUserUpdate):
1717
pass
1818

1919

tests/test_fastapi_users_db_sqlalchemy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ async def test_queries(sqlalchemy_user_db: SQLAlchemyUserDatabase[UserDB]):
107107

108108
# Exception when inserting non-nullable fields
109109
with pytest.raises(sqlite3.IntegrityError):
110-
wrong_user = UserDB(hashed_password="aaa")
110+
# Use construct to bypass Pydantic validation
111+
wrong_user = UserDB.construct(hashed_password="aaa")
111112
await sqlalchemy_user_db.create(wrong_user)
112113

113114
# Unknown user

0 commit comments

Comments
 (0)