Closed michaelkryukov closed 2 years ago
Hey again! Here is my example code base that prompted the previous PR if you want to test against this. If you look at the init_mongo function you can see I'm passing in an arg and a kwarg. If I remove those, your branch les me pass unit tests 100%. Could we also add something to consume excess *args and **kwargs when initializing the client?
And also, a HUGE thank you for even making this library. Unit testing async mongo has been such a pain for the longest time. Despite your repo only being a few days old, it is the most complete / working implementation on the market right now.
Pretty much all the credit goes to mongomock, they did most of the job 😄. Nice to see that I'm not the only one who needed a viable mock for async mongo too. I added *args, **kwargs
to AsyncMongoMockClient's __init__
. This should fix mocking with AsyncMongoMockClient
.
I just confirmed your newest commit passes all tests in my repo using Beanie.
Changes:
isinstance(collection, AsyncIOMotorCollection)
won't fail. It's possible there will still be issues if you expected to use tornado classes instead of asyncio, but I will wait for actual cases to somehow solve this.Notes: