fix: correct failing unit tests for product and import job services

- test_create_import_job_database_error: Monkeypatch db.flush instead
  of db.commit since service uses flush() per architecture rules
- test_create_product_already_exists: Store product_id before exception
  and rollback session to clear PendingRollbackError state
- test_delete_product_success: Add db.flush() to delete_product service
  method to ensure deletion is applied before verification

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-07 18:28:59 +01:00
parent ddc419353e
commit e98a3efe57
3 changed files with 13 additions and 6 deletions

View File

@@ -306,6 +306,7 @@ class MarketplaceProductService:
db.query(Inventory).filter(Inventory.gtin == product.gtin).delete()
db.delete(product)
db.flush()
logger.info(f"Deleted product {marketplace_product_id}")
return True