From ca354063c78f646ecc28d7b65eb3a2b12121b203 Mon Sep 17 00:00:00 2001 From: eclipse Date: Thu, 14 Aug 2025 22:41:33 +0200 Subject: [PATCH] small changes regarding the routes --- tests/integration/test_int_genre.py | 6 +++--- tests/unit/test_unit_genre.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/integration/test_int_genre.py b/tests/integration/test_int_genre.py index 36b01ee..ec2f390 100644 --- a/tests/integration/test_int_genre.py +++ b/tests/integration/test_int_genre.py @@ -9,7 +9,7 @@ class TestIntGenreRead: def test_records_read(self, client, db): """test reading records""" - response = client.get("/genre/all", follow_redirects=True) + response = client.get("/genre/", follow_redirects=True) # good status code assert response.status_code == 200 # two records returned @@ -32,13 +32,13 @@ class TestIntGenreCreate: def test_uniqueness_constraint(self, client, db): """assert uniqueness constraint when adding records""" with pytest.raises(IntegrityError) as excinfo: - client.post("/genre/create", data={"form_Genre": "spam"}) + client.post("/genre/create/", data={"form_Genre": "spam"}) assert "UNIQUE constraint failed" in str(excinfo.value) def test_notempty_constraint(self, client): """assert non-empty constraint when adding record""" with pytest.raises(IntegrityError) as excinfo: - client.post("/genre/create", data={"form_Genre": ""}) + client.post("/genre/create/", data={"form_Genre": ""}) assert "CHECK constraint failed" in str(excinfo.value) diff --git a/tests/unit/test_unit_genre.py b/tests/unit/test_unit_genre.py index 5e12535..5bd4683 100644 --- a/tests/unit/test_unit_genre.py +++ b/tests/unit/test_unit_genre.py @@ -13,7 +13,7 @@ class TestUnitGenreRead: Genre(ID=4, Genre="SpAm"), Genre(ID=26, Genre="eGgS") ]) - response = client.get("/genre") + response = client.get("/genre/", follow_redirects=True) # assert good HTTP response assert response.status_code == 200 # assert two records read @@ -24,13 +24,13 @@ class TestUnitGenreRead: def test_get_request_with_query(self, client): """test GET request with query string""" - response = client.get("/genre", query_string={"id": 1, "form_genre": "spam"}) + response = client.get("/genre/", query_string={"id": 1, "form_genre": "spam"}, follow_redirects=True) # assert good HTTP response assert response.status_code == 200 def test_post_request(self, client): """test POST request""" - response = client.post("/genre") + response = client.post("/genre/", follow_redirects=True) assert response.status_code == 405 @@ -63,7 +63,7 @@ class TestUnitGenreCreate: def test_get_request(self, client): """test a GET request""" - response = client.get("/genre/create", query_string={"form_Genre": "spam & eggs"}) + response = client.get("/genre/create/", query_string={"form_Genre": "spam & eggs"}) assert response.status_code == 405