major refactoring adding vendor and customer features

This commit is contained in:
2025-10-11 09:09:25 +02:00
parent f569995883
commit dd16198276
126 changed files with 15109 additions and 3747 deletions

View File

@@ -193,7 +193,7 @@ class TestPagination:
vendor = Vendor(
vendor_code=f"PAGEVENDOR{i:03d}_{unique_suffix}",
vendor_name=f"Pagination Vendor {i}",
owner_id=test_user.id,
owner_user_id=test_user.id,
is_active=True,
)
vendors.append(vendor)
@@ -212,33 +212,33 @@ class TestPagination:
assert data["skip"] == 0
assert data["limit"] == 5
def test_stock_pagination_success(self, client, auth_headers, db):
"""Test pagination for stock listing successfully"""
def test_inventory_pagination_success(self, client, auth_headers, db):
"""Test pagination for inventory listing successfully"""
import uuid
unique_suffix = str(uuid.uuid4())[:8]
# Create multiple stock entries
from models.database.stock import Stock
stocks = []
# Create multiple inventory entries
from models.database.inventory import Inventory
inventory_entries = []
for i in range(20):
stock = Stock(
inventory = Inventory(
gtin=f"123456789{i:04d}",
location=f"LOC_{unique_suffix}_{i}",
quantity=10 + i,
)
stocks.append(stock)
inventory_entries.append(inventory)
db.add_all(stocks)
db.add_all(inventory_entries)
db.commit()
# Test first page
response = client.get("/api/v1/stock?limit=8&skip=0", headers=auth_headers)
response = client.get("/api/v1/inventory?limit=8&skip=0", headers=auth_headers)
assert response.status_code == 200
data = response.json()
assert len(data) == 8
# Test second page
response = client.get("/api/v1/stock?limit=8&skip=8", headers=auth_headers)
response = client.get("/api/v1/inventory?limit=8&skip=8", headers=auth_headers)
assert response.status_code == 200
data = response.json()
assert len(data) == 8