QC check
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
# tests/unit/__init__.py
|
||||
"""Unit tests - fast, isolated component tests."""
|
||||
|
||||
|
||||
@@ -3,4 +3,3 @@
|
||||
import pytest
|
||||
|
||||
# Add any unit-specific fixtures here if needed
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import pytest
|
||||
from middleware.auth import AuthManager
|
||||
from middleware.rate_limiter import RateLimiter
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.auth # for auth manager tests
|
||||
class TestRateLimiter:
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# tests/unit/models/__init__.py
|
||||
"""Database and API model unit tests."""
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# tests/unit/services/__init__.py
|
||||
"""Service layer unit tests."""
|
||||
|
||||
|
||||
@@ -114,4 +114,4 @@ class TestAdminService:
|
||||
assert test_job is not None
|
||||
assert test_job.marketplace == test_marketplace_job.marketplace
|
||||
assert test_job.shop_name == test_marketplace_job.shop_name
|
||||
assert test_job.status == test_marketplace_job.status
|
||||
assert test_job.status == test_marketplace_job.status
|
||||
|
||||
@@ -6,6 +6,7 @@ from app.services.auth_service import AuthService
|
||||
from models.api.auth import UserLogin, UserRegister
|
||||
from models.database.user import User
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.auth
|
||||
class TestAuthService:
|
||||
|
||||
@@ -10,6 +10,7 @@ from models.database.marketplace import MarketplaceImportJob
|
||||
from models.database.shop import Shop
|
||||
from models.database.user import User
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.marketplace
|
||||
class TestMarketplaceService:
|
||||
|
||||
@@ -5,6 +5,7 @@ from app.services.product_service import ProductService
|
||||
from models.api.product import ProductCreate
|
||||
from models.database.product import Product
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.products
|
||||
class TestProductService:
|
||||
|
||||
@@ -5,6 +5,7 @@ from fastapi import HTTPException
|
||||
from app.services.shop_service import ShopService
|
||||
from models.api.shop import ShopCreate, ShopProductCreate
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.shops
|
||||
class TestShopService:
|
||||
|
||||
@@ -5,6 +5,7 @@ from app.services.stats_service import StatsService
|
||||
from models.database.product import Product
|
||||
from models.database.stock import Stock
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.stats
|
||||
class TestStatsService:
|
||||
|
||||
@@ -8,6 +8,7 @@ from models.api.stock import StockAdd, StockCreate, StockUpdate
|
||||
from models.database.product import Product
|
||||
from models.database.stock import Stock
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.stock
|
||||
class TestStockService:
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# tests/unit/utils/__init__.py
|
||||
"""Utility function unit tests."""
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import requests.exceptions
|
||||
|
||||
from utils.csv_processor import CSVProcessor
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestCSVProcessor:
|
||||
def setup_method(self):
|
||||
@@ -80,7 +81,9 @@ class TestCSVProcessor:
|
||||
# Mock failed HTTP response - need to make raise_for_status() raise an exception
|
||||
mock_response = Mock()
|
||||
mock_response.status_code = 404
|
||||
mock_response.raise_for_status.side_effect = requests.exceptions.HTTPError("404 Not Found")
|
||||
mock_response.raise_for_status.side_effect = requests.exceptions.HTTPError(
|
||||
"404 Not Found"
|
||||
)
|
||||
mock_get.return_value = mock_response
|
||||
|
||||
with pytest.raises(requests.exceptions.HTTPError):
|
||||
|
||||
@@ -3,6 +3,7 @@ import pytest
|
||||
|
||||
from utils.data_processing import GTINProcessor, PriceProcessor
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestDataValidation:
|
||||
def test_gtin_normalization_edge_cases(self):
|
||||
|
||||
Reference in New Issue
Block a user