I am not able to run this test, i always have the same error RuntimeError: Event loop is closed
What i need to add to this code?
from motor.motor_asyncio import AsyncIOMotorClient
import pytest
import asyncio
client = AsyncIOMotorClient("mongodb://mongo:mongo@192.168.0.11:27017/admin?retryWrites=false")
db = client['app']
aux = db['users']
async def create_user_db(a: dict):
x = await aux.insert_one(a)
return x
@pytest.mark.asyncio
async def test_create():
form = {'username': 'c3', 'password': 'c3'}
res = await create_user_db(form)
assert res != None
This is the error