diff --git a/app/exception handlers/__init__.py b/app/exception handlers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/api/test_stuff.py b/tests/api/test_stuff.py index e1352c2..9445c7e 100644 --- a/tests/api/test_stuff.py +++ b/tests/api/test_stuff.py @@ -25,9 +25,15 @@ async def test_add_stuff(client: AsyncClient): "description": stuff["description"], } ) + response = await client.post("/stuff", json=stuff) + assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR + assert response.json() == snapshot({'message':'A database error occurred. Please try again later.'}) async def test_get_stuff(client: AsyncClient): + response = await client.get(f"/stuff/nonexistent") + assert response.status_code == status.HTTP_404_NOT_FOUND + assert response.json() == snapshot({'no_response':'The requested resource was not found'}) stuff = StuffFactory.build(factory_use_constructors=True).model_dump(mode="json") await client.post("/stuff", json=stuff) name = stuff["name"]