Application fully migrated to modular approach
This commit is contained in:
@@ -20,7 +20,7 @@ class TestPagination:
|
||||
db.commit()
|
||||
|
||||
# Test first page
|
||||
response = client.get("/api/v1/products?limit=10&skip=0", headers=auth_headers)
|
||||
response = client.get("/api/v1/product?limit=10&skip=0", headers=auth_headers)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert len(data["products"]) == 10
|
||||
@@ -29,14 +29,14 @@ class TestPagination:
|
||||
assert data["limit"] == 10
|
||||
|
||||
# Test second page
|
||||
response = client.get("/api/v1/products?limit=10&skip=10", headers=auth_headers)
|
||||
response = client.get("/api/v1/product?limit=10&skip=10", headers=auth_headers)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert len(data["products"]) == 10
|
||||
assert data["skip"] == 10
|
||||
|
||||
# Test last page
|
||||
response = client.get("/api/v1/products?limit=10&skip=20", headers=auth_headers)
|
||||
response = client.get("/api/v1/product?limit=10&skip=20", headers=auth_headers)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert len(data["products"]) == 5 # Only 5 remaining
|
||||
@@ -44,13 +44,13 @@ class TestPagination:
|
||||
def test_pagination_boundaries(self, client, auth_headers):
|
||||
"""Test pagination boundary conditions"""
|
||||
# Test negative skip
|
||||
response = client.get("/api/v1/products?skip=-1", headers=auth_headers)
|
||||
response = client.get("/api/v1/product?skip=-1", headers=auth_headers)
|
||||
assert response.status_code == 422 # Validation error
|
||||
|
||||
# Test zero limit
|
||||
response = client.get("/api/v1/products?limit=0", headers=auth_headers)
|
||||
response = client.get("/api/v1/product?limit=0", headers=auth_headers)
|
||||
assert response.status_code == 422 # Validation error
|
||||
|
||||
# Test excessive limit
|
||||
response = client.get("/api/v1/products?limit=10000", headers=auth_headers)
|
||||
response = client.get("/api/v1/product?limit=10000", headers=auth_headers)
|
||||
assert response.status_code == 422 # Should be limited
|
||||
|
||||
Reference in New Issue
Block a user