From ccaf7bf3ffc80afae5aeb313ed1a991ed8edce48 Mon Sep 17 00:00:00 2001 From: Parham Alvani Date: Tue, 19 Mar 2024 21:35:31 +0000 Subject: [PATCH] feat: add more tests --- app/test_main.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/test_main.py b/app/test_main.py index 75420c7..2c2be34 100644 --- a/app/test_main.py +++ b/app/test_main.py @@ -12,6 +12,27 @@ class TestMain(TestCase): client = TestClient(app) + def test_user_create_and_delete(self): + """ + Create a user and then delete it. + """ + future_user = { + "first_name": "Parham", + "last_name": "Alvani", + "average": 18.0, + } + + response = self.client.post( + "/users", + json=future_user, + ) + assert response.status_code == 200 + user = response.json() + assert future_user.items() <= user.items() + + response = self.client.delete(f"/users/{user['id']}") + assert response.status_code == 200 + def test_users_create_and_list(self): """ Create valid users and make sure it returns in the users list.