code quality run
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# tests/test_product_service.py
|
||||
import pytest
|
||||
|
||||
from app.services.product_service import ProductService
|
||||
from models.api_models import ProductCreate
|
||||
from models.database_models import Product
|
||||
@@ -16,7 +17,7 @@ class TestProductService:
|
||||
title="Service Test Product",
|
||||
gtin="1234567890123",
|
||||
price="19.99",
|
||||
marketplace="TestMarket"
|
||||
marketplace="TestMarket",
|
||||
)
|
||||
|
||||
product = self.service.create_product(db, product_data)
|
||||
@@ -31,7 +32,7 @@ class TestProductService:
|
||||
product_id="SVC002",
|
||||
title="Service Test Product",
|
||||
gtin="invalid_gtin",
|
||||
price="19.99"
|
||||
price="19.99",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="Invalid GTIN format"):
|
||||
@@ -39,10 +40,7 @@ class TestProductService:
|
||||
|
||||
def test_get_products_with_filters(self, db, test_product):
|
||||
"""Test getting products with various filters"""
|
||||
products, total = self.service.get_products_with_filters(
|
||||
db,
|
||||
brand="TestBrand"
|
||||
)
|
||||
products, total = self.service.get_products_with_filters(db, brand="TestBrand")
|
||||
|
||||
assert total == 1
|
||||
assert len(products) == 1
|
||||
@@ -51,10 +49,8 @@ class TestProductService:
|
||||
def test_get_products_with_search(self, db, test_product):
|
||||
"""Test getting products with search"""
|
||||
products, total = self.service.get_products_with_filters(
|
||||
db,
|
||||
search="Test Product"
|
||||
db, search="Test Product"
|
||||
)
|
||||
|
||||
assert total == 1
|
||||
assert len(products) == 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user