small changes regarding the routes

This commit is contained in:
eclipse 2025-08-14 22:41:33 +02:00
parent 25eac9bfb4
commit ca354063c7
2 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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