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

@@ -16,7 +16,7 @@ class TestIntegrationFlows:
"price": "29.99",
"brand": "FlowBrand",
"gtin": "1111222233334",
"availability": "in stock",
"availability": "in inventory",
"marketplace": "TestFlow",
}
@@ -26,23 +26,23 @@ class TestIntegrationFlows:
assert response.status_code == 200
product = response.json()
# 2. Add stock for the product
stock_data = {
# 2. Add inventory for the product
inventory_data = {
"gtin": product["gtin"],
"location": "MAIN_WAREHOUSE",
"quantity": 50,
}
response = client.post("/api/v1/stock", headers=auth_headers, json=stock_data)
response = client.post("/api/v1/inventory", headers=auth_headers, json=inventory_data)
assert response.status_code == 200
# 3. Get product with stock info
# 3. Get product with inventory info
response = client.get(
f"/api/v1/marketplace/product/{product['marketplace_product_id']}", headers=auth_headers
)
assert response.status_code == 200
product_detail = response.json()
assert product_detail["stock_info"]["total_quantity"] == 50
assert product_detail["inventory_info"]["total_quantity"] == 50
# 4. Update product
update_data = {"title": "Updated Integration Test MarketplaceProduct"}
@@ -65,7 +65,7 @@ class TestIntegrationFlows:
# 1. Create a vendor
vendor_data = {
"vendor_code": "FLOWVENDOR",
"vendor_name": "Integration Flow Vendor",
"name": "Integration Flow Vendor",
"description": "Test vendor for integration",
}
@@ -94,38 +94,38 @@ class TestIntegrationFlows:
response = client.get(f"/api/v1/vendor/{vendor ['vendor_code']}", headers=auth_headers)
assert response.status_code == 200
def test_stock_operations_workflow(self, client, auth_headers):
"""Test complete stock management workflow"""
def test_inventory_operations_workflow(self, client, auth_headers):
"""Test complete inventory management workflow"""
gtin = "9999888877776"
location = "TEST_WAREHOUSE"
# 1. Set initial stock
# 1. Set initial inventory
response = client.post(
"/api/v1/stock",
"/api/v1/inventory",
headers=auth_headers,
json={"gtin": gtin, "location": location, "quantity": 100},
)
assert response.status_code == 200
# 2. Add more stock
# 2. Add more inventory
response = client.post(
"/api/v1/stock/add",
"/api/v1/inventory/add",
headers=auth_headers,
json={"gtin": gtin, "location": location, "quantity": 25},
)
assert response.status_code == 200
assert response.json()["quantity"] == 125
# 3. Remove some stock
# 3. Remove some inventory
response = client.post(
"/api/v1/stock/remove",
"/api/v1/inventory/remove",
headers=auth_headers,
json={"gtin": gtin, "location": location, "quantity": 30},
)
assert response.status_code == 200
assert response.json()["quantity"] == 95
# 4. Check total stock
response = client.get(f"/api/v1/stock/{gtin}/total", headers=auth_headers)
# 4. Check total inventory
response = client.get(f"/api/v1/inventory/{gtin}/total", headers=auth_headers)
assert response.status_code == 200
assert response.json()["total_quantity"] == 95