code quality run
This commit is contained in:
@@ -31,7 +31,9 @@ class TestProductsAPI:
|
||||
assert response.json()["total"] == 1
|
||||
|
||||
# Test marketplace filter
|
||||
response = client.get("/api/v1/product?marketplace=Letzshop", headers=auth_headers)
|
||||
response = client.get(
|
||||
"/api/v1/product?marketplace=Letzshop", headers=auth_headers
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["total"] == 1
|
||||
|
||||
@@ -50,10 +52,12 @@ class TestProductsAPI:
|
||||
"brand": "NewBrand",
|
||||
"gtin": "9876543210987",
|
||||
"availability": "in stock",
|
||||
"marketplace": "Amazon"
|
||||
"marketplace": "Amazon",
|
||||
}
|
||||
|
||||
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
|
||||
data = response.json()
|
||||
@@ -71,10 +75,12 @@ class TestProductsAPI:
|
||||
"brand": "NewBrand",
|
||||
"gtin": "9876543210987",
|
||||
"availability": "in stock",
|
||||
"marketplace": "Amazon"
|
||||
"marketplace": "Amazon",
|
||||
}
|
||||
|
||||
response = client.post("/api/v1/product", headers=auth_headers, json=product_data)
|
||||
response = client.post(
|
||||
"/api/v1/product", headers=auth_headers, json=product_data
|
||||
)
|
||||
|
||||
# Debug output
|
||||
print(f"Status Code: {response.status_code}")
|
||||
@@ -89,7 +95,9 @@ class TestProductsAPI:
|
||||
|
||||
def test_get_product_by_id(self, client, auth_headers, test_product):
|
||||
"""Test getting specific product"""
|
||||
response = client.get(f"/api/v1/product/{test_product.product_id}", headers=auth_headers)
|
||||
response = client.get(
|
||||
f"/api/v1/product/{test_product.product_id}", headers=auth_headers
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
@@ -104,15 +112,12 @@ class TestProductsAPI:
|
||||
|
||||
def test_update_product(self, client, auth_headers, test_product):
|
||||
"""Test updating product"""
|
||||
update_data = {
|
||||
"title": "Updated Product Title",
|
||||
"price": "25.99"
|
||||
}
|
||||
update_data = {"title": "Updated Product Title", "price": "25.99"}
|
||||
|
||||
response = client.put(
|
||||
f"/api/v1/product/{test_product.product_id}",
|
||||
headers=auth_headers,
|
||||
json=update_data
|
||||
json=update_data,
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
@@ -123,8 +128,7 @@ class TestProductsAPI:
|
||||
def test_delete_product(self, client, auth_headers, test_product):
|
||||
"""Test deleting product"""
|
||||
response = client.delete(
|
||||
f"/api/v1/product/{test_product.product_id}",
|
||||
headers=auth_headers
|
||||
f"/api/v1/product/{test_product.product_id}", headers=auth_headers
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user