Fix SQLAlchemy initialization issue in multi-output transaction tests

Remove spec parameter from MagicMock to avoid triggering SQLAlchemy mapper
initialization during test setup. Tests remain effective by validating actual
crypto watcher logic while mocking only the database object interfaces.
This commit is contained in:
Russell Ballestrini 2025-10-03 11:40:34 -04:00
parent 8301e23c3f
commit f85cd3907c

View file

@ -20,20 +20,20 @@ class TestMultiOutputTransactionTracking(unittest.TestCase):
def setUp(self):
"""Set up test fixtures."""
# Create mock shop
self.shop = MagicMock(spec=Shop)
# Create mock shop (no spec to avoid SQLAlchemy initialization issues)
self.shop = MagicMock()
self.shop.id = uuid.uuid4()
self.shop.xmr_cold_wallet_address = "XMRColdWallet123"
self.shop.doge_cold_wallet_address = "DColdWallet123"
# Create mock invoice
self.invoice = MagicMock(spec=Invoice)
self.invoice = MagicMock()
self.invoice.id = uuid.uuid4()
self.invoice.shop = self.shop
self.invoice.total_amount_in_usd_cents = 1000 # $10
# Create mock payment
self.payment = MagicMock(spec=CryptoPayment)
self.payment = MagicMock()
self.payment.id = uuid.uuid4()
self.payment.uuid_str = str(self.payment.id)
self.payment.coin_type = "XMR"