22
33import pymongo .errors
44import pytest
5- from beanie import init_beanie
5+ from beanie import PydanticObjectId , init_beanie
66from motor .motor_asyncio import AsyncIOMotorClient , AsyncIOMotorDatabase
77from pydantic import Field
88
@@ -64,7 +64,8 @@ async def beanie_user_db_oauth(
6464
6565@pytest .mark .asyncio
6666async def test_queries (
67- beanie_user_db : BeanieUserDatabase [User ], oauth_account1 : Dict [str , Any ]
67+ beanie_user_db : BeanieUserDatabase [User , PydanticObjectId ],
68+ oauth_account1 : Dict [str , Any ],
6869):
6970 user_create = {
7071 "email" : "lancelot@camelot.bt" ,
@@ -133,7 +134,10 @@ async def test_queries(
133134 ],
134135)
135136async def test_email_query (
136- beanie_user_db : BeanieUserDatabase [User ], email : str , query : str , found : bool
137+ beanie_user_db : BeanieUserDatabase [User , PydanticObjectId ],
138+ email : str ,
139+ query : str ,
140+ found : bool ,
137141):
138142 user_create = {
139143 "email" : email ,
@@ -151,7 +155,9 @@ async def test_email_query(
151155
152156
153157@pytest .mark .asyncio
154- async def test_insert_existing_email (beanie_user_db : BeanieUserDatabase [User ]):
158+ async def test_insert_existing_email (
159+ beanie_user_db : BeanieUserDatabase [User , PydanticObjectId ]
160+ ):
155161 user_create = {
156162 "email" : "lancelot@camelot.bt" ,
157163 "hashed_password" : "guinevere" ,
@@ -164,7 +170,7 @@ async def test_insert_existing_email(beanie_user_db: BeanieUserDatabase[User]):
164170
165171@pytest .mark .asyncio
166172async def test_queries_custom_fields (
167- beanie_user_db : BeanieUserDatabase [User ],
173+ beanie_user_db : BeanieUserDatabase [User , PydanticObjectId ],
168174):
169175 """It should output custom fields in query result."""
170176 user_create = {
@@ -183,7 +189,7 @@ async def test_queries_custom_fields(
183189
184190@pytest .mark .asyncio
185191async def test_queries_oauth (
186- beanie_user_db_oauth : BeanieUserDatabase [UserOAuth ],
192+ beanie_user_db_oauth : BeanieUserDatabase [UserOAuth , PydanticObjectId ],
187193 oauth_account1 : Dict [str , Any ],
188194 oauth_account2 : Dict [str , Any ],
189195):
0 commit comments