code quality run
This commit is contained in:
@@ -14,10 +14,12 @@ class TestIntegrationFlows:
|
||||
"brand": "FlowBrand",
|
||||
"gtin": "1111222233334",
|
||||
"availability": "in stock",
|
||||
"marketplace": "TestFlow"
|
||||
"marketplace": "TestFlow",
|
||||
}
|
||||
|
||||
response = client.post("/api/v1/product", headers=auth_headers, json=product_data)
|
||||
response = client.post(
|
||||
"/api/v1/product", headers=auth_headers, json=product_data
|
||||
)
|
||||
assert response.status_code == 200
|
||||
product = response.json()
|
||||
|
||||
@@ -25,26 +27,33 @@ class TestIntegrationFlows:
|
||||
stock_data = {
|
||||
"gtin": product["gtin"],
|
||||
"location": "MAIN_WAREHOUSE",
|
||||
"quantity": 50
|
||||
"quantity": 50,
|
||||
}
|
||||
|
||||
response = client.post("/api/v1/stock", headers=auth_headers, json=stock_data)
|
||||
assert response.status_code == 200
|
||||
|
||||
# 3. Get product with stock info
|
||||
response = client.get(f"/api/v1/product/{product['product_id']}", headers=auth_headers)
|
||||
response = client.get(
|
||||
f"/api/v1/product/{product['product_id']}", headers=auth_headers
|
||||
)
|
||||
assert response.status_code == 200
|
||||
product_detail = response.json()
|
||||
assert product_detail["stock_info"]["total_quantity"] == 50
|
||||
|
||||
# 4. Update product
|
||||
update_data = {"title": "Updated Integration Test Product"}
|
||||
response = client.put(f"/api/v1/product/{product['product_id']}",
|
||||
headers=auth_headers, json=update_data)
|
||||
response = client.put(
|
||||
f"/api/v1/product/{product['product_id']}",
|
||||
headers=auth_headers,
|
||||
json=update_data,
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
# 5. Search for product
|
||||
response = client.get("/api/v1/product?search=Updated Integration", headers=auth_headers)
|
||||
response = client.get(
|
||||
"/api/v1/product?search=Updated Integration", headers=auth_headers
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["total"] == 1
|
||||
|
||||
@@ -54,7 +63,7 @@ class TestIntegrationFlows:
|
||||
shop_data = {
|
||||
"shop_code": "FLOWSHOP",
|
||||
"shop_name": "Integration Flow Shop",
|
||||
"description": "Test shop for integration"
|
||||
"description": "Test shop for integration",
|
||||
}
|
||||
|
||||
response = client.post("/api/v1/shop", headers=auth_headers, json=shop_data)
|
||||
@@ -66,10 +75,12 @@ class TestIntegrationFlows:
|
||||
"product_id": "SHOPFLOW001",
|
||||
"title": "Shop Flow Product",
|
||||
"price": "15.99",
|
||||
"marketplace": "ShopFlow"
|
||||
"marketplace": "ShopFlow",
|
||||
}
|
||||
|
||||
response = client.post("/api/v1/product", headers=auth_headers, json=product_data)
|
||||
response = client.post(
|
||||
"/api/v1/product", headers=auth_headers, json=product_data
|
||||
)
|
||||
assert response.status_code == 200
|
||||
product = response.json()
|
||||
|
||||
@@ -86,28 +97,28 @@ class TestIntegrationFlows:
|
||||
location = "TEST_WAREHOUSE"
|
||||
|
||||
# 1. Set initial stock
|
||||
response = client.post("/api/v1/stock", headers=auth_headers, json={
|
||||
"gtin": gtin,
|
||||
"location": location,
|
||||
"quantity": 100
|
||||
})
|
||||
response = client.post(
|
||||
"/api/v1/stock",
|
||||
headers=auth_headers,
|
||||
json={"gtin": gtin, "location": location, "quantity": 100},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
# 2. Add more stock
|
||||
response = client.post("/api/v1/stock/add", headers=auth_headers, json={
|
||||
"gtin": gtin,
|
||||
"location": location,
|
||||
"quantity": 25
|
||||
})
|
||||
response = client.post(
|
||||
"/api/v1/stock/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
|
||||
response = client.post("/api/v1/stock/remove", headers=auth_headers, json={
|
||||
"gtin": gtin,
|
||||
"location": location,
|
||||
"quantity": 30
|
||||
})
|
||||
response = client.post(
|
||||
"/api/v1/stock/remove",
|
||||
headers=auth_headers,
|
||||
json={"gtin": gtin, "location": location, "quantity": 30},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["quantity"] == 95
|
||||
|
||||
|
||||
Reference in New Issue
Block a user