mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Add extra tests
This commit is contained in:
parent
8227190a8d
commit
1aeaa71ef8
2 changed files with 17 additions and 17 deletions
16
tests/test_database/test_crud/test_dad_jokes.py
Normal file
16
tests/test_database/test_crud/test_dad_jokes.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from database.crud import dad_jokes as crud
|
||||
from database.models import DadJoke
|
||||
|
||||
|
||||
async def test_add_dad_joke(database_session: AsyncSession):
|
||||
"""Test creating a new joke"""
|
||||
statement = select(DadJoke)
|
||||
result = (await database_session.execute(statement)).scalars().all()
|
||||
assert len(result) == 0
|
||||
|
||||
await crud.add_dad_joke(database_session, "joke")
|
||||
result = (await database_session.execute(statement)).scalars().all()
|
||||
assert len(result) == 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue