test: update service tests for fixture and API changes

Updates to work with refactored fixtures (no expunge):
- Re-query entities when modifying state in tests
- Remove assertions on expunged object properties

Auth service tests:
- Update to use email_or_username field instead of username

Admin service tests:
- Fix statistics test to use stats_service module
- Remove vendor_name filter test (field removed)
- Update import job assertions

Inventory/Marketplace/Stats/Vendor service tests:
- Refactor to work with attached session objects
- Update assertions for changed response formats
- Improve test isolation and cleanup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-05 21:42:52 +01:00
parent ca9f17fc37
commit 120d8196fe
7 changed files with 1488 additions and 1422 deletions

View File

@@ -265,18 +265,15 @@ class TestProductService:
def test_get_inventory_info_success(
self, db, test_marketplace_product_with_inventory
):
"""Test getting inventory info for product with inventory"""
# Extract the product from the dictionary
marketplace_product = test_marketplace_product_with_inventory[
"marketplace_product"
]
"""Test getting inventory info for product with inventory."""
marketplace_product = test_marketplace_product_with_inventory["marketplace_product"]
inventory = test_marketplace_product_with_inventory["inventory"]
inventory_info = self.service.get_inventory_info(db, marketplace_product.gtin)
assert inventory_info is not None
assert inventory_info.gtin == marketplace_product.gtin
assert inventory_info.total_quantity > 0
assert len(inventory_info.locations) > 0
assert inventory_info.total_quantity == inventory.quantity
assert len(inventory_info.locations) >= 1
def test_get_inventory_info_no_inventory(self, db, test_marketplace_product):
"""Test getting inventory info for product without inventory"""