add test for async function

This commit is contained in:
zhangxunhui 2021-08-14 21:09:55 +08:00
parent 915f8a3ae2
commit 98860b6961
3 changed files with 11 additions and 7 deletions

View File

View File

@ -0,0 +1,11 @@
import sys, pathlib
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
from app.db.events import connect_to_db
from app.utils.global_variables import GlobalVariable
import pytest, aiomysql
@pytest.mark.asyncio
async def test_connect_to_db() -> None:
await connect_to_db()
assert type(GlobalVariable.dbPool) == aiomysql.pool.Pool

View File

@ -1,7 +0,0 @@
import sys, pathlib
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
from app.services.authentication import auth
def test_auth_func() -> None:
auth()