Refactoring code for modular approach

This commit is contained in:
2025-09-12 21:37:08 +02:00
parent 12e0d64484
commit c7d6b33cd5
15 changed files with 1419 additions and 184 deletions

View File

@@ -11,7 +11,7 @@ class TestShopsAPI:
"description": "A new test shop"
}
response = client.post("/api/v1/shops", headers=auth_headers, json=shop_data)
response = client.post("/api/v1/shop", headers=auth_headers, json=shop_data)
assert response.status_code == 200
data = response.json()
@@ -22,18 +22,18 @@ class TestShopsAPI:
def test_create_shop_duplicate_code(self, client, auth_headers, test_shop):
"""Test creating shop with duplicate code"""
shop_data = {
"shop_code": "TESTSHOP", # Same as test_shop
"shop_name": "Another Shop"
"shop_code": test_shop.shop_code, # Same as test_shop
"shop_name": test_shop.shop_name
}
response = client.post("/api/v1/shops", headers=auth_headers, json=shop_data)
response = client.post("/api/v1/shop", headers=auth_headers, json=shop_data)
assert response.status_code == 400
assert "already exists" in response.json()["detail"]
def test_get_shops(self, client, auth_headers, test_shop):
"""Test getting shops list"""
response = client.get("/api/v1/shops", headers=auth_headers)
response = client.get("/api/v1/shop", headers=auth_headers)
assert response.status_code == 200
data = response.json()
@@ -42,7 +42,7 @@ class TestShopsAPI:
def test_get_shop_by_code(self, client, auth_headers, test_shop):
"""Test getting specific shop"""
response = client.get(f"/api/v1/shops/{test_shop.shop_code}", headers=auth_headers)
response = client.get(f"/api/v1/shop/{test_shop.shop_code}", headers=auth_headers)
assert response.status_code == 200
data = response.json()
@@ -51,5 +51,5 @@ class TestShopsAPI:
def test_shops_require_auth(self, client):
"""Test that shop endpoints require authentication"""
response = client.get("/api/v1/shops")
response = client.get("/api/v1/shop")
assert response.status_code == 403