mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 19:30:47 +08:00
Use real UUID for User id. and OAuthAccount id. (#198)
* Use UUID for user id and oauth account id * Update documentation for UUID * Tweak GUID definition of SQLAlchemy to match Tortoise ORM one * Write migration doc
This commit is contained in:
@ -15,7 +15,9 @@ def get_mongodb_user_db():
|
||||
user_model,
|
||||
) -> AsyncGenerator[MongoDBUserDatabase, None]:
|
||||
client = motor.motor_asyncio.AsyncIOMotorClient(
|
||||
"mongodb://localhost:27017", serverSelectionTimeoutMS=100
|
||||
"mongodb://localhost:27017",
|
||||
serverSelectionTimeoutMS=100,
|
||||
uuidRepresentation="standard",
|
||||
)
|
||||
|
||||
try:
|
||||
@ -50,9 +52,7 @@ async def mongodb_user_db_oauth(get_mongodb_user_db):
|
||||
@pytest.mark.db
|
||||
async def test_queries(mongodb_user_db: MongoDBUserDatabase[UserDB]):
|
||||
user = UserDB(
|
||||
id="111",
|
||||
email="lancelot@camelot.bt",
|
||||
hashed_password=get_password_hash("guinevere"),
|
||||
email="lancelot@camelot.bt", hashed_password=get_password_hash("guinevere"),
|
||||
)
|
||||
|
||||
# Create
|
||||
@ -96,7 +96,6 @@ async def test_queries(mongodb_user_db: MongoDBUserDatabase[UserDB]):
|
||||
async def test_queries_custom_fields(mongodb_user_db: MongoDBUserDatabase[UserDB]):
|
||||
"""It should output custom fields in query result."""
|
||||
user = UserDB(
|
||||
id="111",
|
||||
email="lancelot@camelot.bt",
|
||||
hashed_password=get_password_hash("guinevere"),
|
||||
first_name="Lancelot",
|
||||
@ -117,7 +116,6 @@ async def test_queries_oauth(
|
||||
oauth_account2,
|
||||
):
|
||||
user = UserDBOAuth(
|
||||
id="111",
|
||||
email="lancelot@camelot.bt",
|
||||
hashed_password=get_password_hash("guinevere"),
|
||||
oauth_accounts=[oauth_account1, oauth_account2],
|
||||
|
Reference in New Issue
Block a user