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:
François Voron
2020-05-21 16:40:33 +02:00
committed by GitHub
parent df479a9003
commit 0a0dcadfdc
24 changed files with 260 additions and 98 deletions

View File

@ -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],