add set of unit tests

This commit is contained in:
grillazz
2021-03-28 17:12:35 +02:00
parent 8f7e264fd1
commit 15aed1bd71
5 changed files with 102 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
from uuid import UUID
from fastapi import APIRouter, Depends
from fastapi import APIRouter, Depends, status
from sqlalchemy.ext.asyncio import AsyncSession
from the_app.database import get_db
@@ -10,7 +10,7 @@ from the_app.schemas.stuff import StuffResponse, StuffSchema
router = APIRouter()
@router.post("/", response_model=StuffResponse)
@router.post("/", status_code=status.HTTP_201_CREATED)
async def create_stuff(stuff: StuffSchema, db_session: AsyncSession = Depends(get_db)):
stuff_id = await Stuff.create(db_session, stuff)
return {**stuff.dict(), "id": stuff_id}