mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
Implement password hash migration
This commit is contained in:
@@ -33,16 +33,21 @@ async def test_queries(user, sqlalchemy_user_db):
|
||||
assert user_db.is_superuser is False
|
||||
assert user_db.email == user.email
|
||||
|
||||
# Update
|
||||
user_db.is_superuser = True
|
||||
await sqlalchemy_user_db.update(user_db)
|
||||
|
||||
# Get by email
|
||||
email_user = await sqlalchemy_user_db.get_by_email(user.email)
|
||||
assert email_user.id == user_db.id
|
||||
assert email_user.is_superuser is True
|
||||
|
||||
# List
|
||||
users = await sqlalchemy_user_db.list()
|
||||
assert len(users) == 1
|
||||
first_user = users[0]
|
||||
assert first_user.id == user_db.id
|
||||
|
||||
# Get by email
|
||||
email_user = await sqlalchemy_user_db.get_by_email(user.email)
|
||||
assert email_user.id == user_db.id
|
||||
|
||||
# Exception when inserting existing email
|
||||
with pytest.raises(sqlite3.IntegrityError):
|
||||
await sqlalchemy_user_db.create(user)
|
||||
|
||||
Reference in New Issue
Block a user