test updates to take into account exception management

This commit is contained in:
2025-09-27 13:47:36 +02:00
parent 3e720212d9
commit 6b9817f179
38 changed files with 2951 additions and 871 deletions

View File

@@ -214,7 +214,7 @@ class TestStatsService:
def test_get_product_count(self, db, test_product):
"""Test getting total product count"""
count = self.service.get_product_count(db)
count = self.service._get_product_count(db)
assert count >= 1
assert isinstance(count, int)
@@ -245,7 +245,7 @@ class TestStatsService:
db.add_all(brand_products)
db.commit()
count = self.service.get_unique_brands_count(db)
count = self.service._get_unique_brands_count(db)
assert (
count >= 2
@@ -278,7 +278,7 @@ class TestStatsService:
db.add_all(category_products)
db.commit()
count = self.service.get_unique_categories_count(db)
count = self.service._get_unique_categories_count(db)
assert count >= 2 # At least Electronics and Books
assert isinstance(count, int)
@@ -307,7 +307,7 @@ class TestStatsService:
db.add_all(marketplace_products)
db.commit()
count = self.service.get_unique_marketplaces_count(db)
count = self.service._get_unique_marketplaces_count(db)
assert count >= 2 # At least Amazon and eBay, plus test_product marketplace
assert isinstance(count, int)
@@ -336,7 +336,7 @@ class TestStatsService:
db.add_all(shop_products)
db.commit()
count = self.service.get_unique_shops_count(db)
count = self.service._get_unique_shops_count(db)
assert count >= 2 # At least ShopA and ShopB, plus test_product shop
assert isinstance(count, int)
@@ -405,7 +405,7 @@ class TestStatsService:
db.add_all(marketplace_products)
db.commit()
brands = self.service.get_brands_by_marketplace(db, "SpecificMarket")
brands = self.service._get_brands_by_marketplace(db, "SpecificMarket")
assert len(brands) == 2
assert "SpecificBrand1" in brands
@@ -438,7 +438,7 @@ class TestStatsService:
db.add_all(marketplace_products)
db.commit()
shops = self.service.get_shops_by_marketplace(db, "TestMarketplace")
shops = self.service._get_shops_by_marketplace(db, "TestMarketplace")
assert len(shops) == 2
assert "TestShop1" in shops
@@ -476,13 +476,13 @@ class TestStatsService:
db.add_all(marketplace_products)
db.commit()
count = self.service.get_products_by_marketplace(db, "CountMarketplace")
count = self.service._get_products_by_marketplace_count(db, "CountMarketplace")
assert count == 3
def test_get_products_by_marketplace_not_found(self, db):
"""Test getting product count for non-existent marketplace"""
count = self.service.get_products_by_marketplace(db, "NonExistentMarketplace")
count = self.service._get_products_by_marketplace_count(db, "NonExistentMarketplace")
assert count == 0