Fix tests using the new api root

This commit is contained in:
2026-06-24 15:54:06 +02:00
parent bc663582b5
commit 17842a14fd
7 changed files with 56 additions and 56 deletions
+8 -8
View File
@@ -6,7 +6,7 @@ def test_create_group(client, auth_headers):
"""Test creating a new group."""
group_data = {"name": "New Test Group"}
response = client.post("/groups/", json=group_data, headers=auth_headers)
response = client.post("/api/v1/groups/", json=group_data, headers=auth_headers)
assert response.status_code == 200
data = response.json()
@@ -18,14 +18,14 @@ def test_create_duplicate_group(client, auth_headers, test_group):
"""Test creating a group with a duplicate name."""
group_data = {"name": test_group.name}
response = client.post("/groups/", json=group_data, headers=auth_headers)
response = client.post("/api/v1/groups/", json=group_data, headers=auth_headers)
# This should fail due to unique constraint
assert response.status_code == 409 # Validation error
def test_get_groups(client, auth_headers, test_group):
"""Test retrieving all groups."""
response = client.get("/groups/", headers=auth_headers)
response = client.get("/api/v1/groups/", headers=auth_headers)
assert response.status_code == 200
groups = response.json()
@@ -37,19 +37,19 @@ def test_get_groups(client, auth_headers, test_group):
def test_delete_group(client, auth_headers, test_group):
"""Test deleting a group."""
response = client.delete(f"/groups/{test_group.id}", headers=auth_headers)
response = client.delete(f"/api/v1/groups/{test_group.id}", headers=auth_headers)
assert response.status_code == 200
assert "deleted successfully" in response.json()["message"].lower()
# Verify group is deleted
response = client.get("/groups/", headers=auth_headers)
response = client.get("/api/v1/groups/", headers=auth_headers)
groups = response.json()
assert not any(group["id"] == test_group.id for group in groups)
def test_delete_nonexistent_group(client, auth_headers):
"""Test deleting a non-existent group."""
response = client.delete("/groups/99999", headers=auth_headers)
response = client.delete("/api/v1/groups/99999", headers=auth_headers)
assert response.status_code == 404
@@ -57,12 +57,12 @@ def test_group_operations_by_non_admin(client, user_auth_headers):
"""Test that non-admin users cannot perform group operations."""
# Try to create a group
response = client.post(
"/groups/",
"/api/v1/groups/",
json={"name": "test"},
headers=user_auth_headers
)
assert response.status_code == 403
# Try to get groups
response = client.get("/groups/", headers=user_auth_headers)
response = client.get("/api/v1/groups/", headers=user_auth_headers)
assert response.status_code == 403