diff --git a/tests/unit/test_wallet.py b/tests/unit/test_wallet.py index aa79797a..c8cecc55 100644 --- a/tests/unit/test_wallet.py +++ b/tests/unit/test_wallet.py @@ -613,7 +613,8 @@ async def test_credit_balance() -> None: "routstr.wallet.recieve_token", return_value=(1000, "sat", "http://mint:3338"), ): - amount = await credit_balance(token_str, mock_key, mock_session) + with patch("routstr.wallet.store_cashu_transaction", AsyncMock()): + amount = await credit_balance(token_str, mock_key, mock_session) assert amount == 1000000 # converted to msat assert mock_key.balance == 6000000 # Should be updated after refresh # Verify atomic operations were used @@ -636,7 +637,8 @@ async def test_credit_balance_constrains_redemption_to_key_mint() -> None: receive = AsyncMock(return_value=(1000, "sat", key_mint)) with patch("routstr.wallet.recieve_token", receive): - await credit_balance("cashuAtoken", mock_key, mock_session) + with patch("routstr.wallet.store_cashu_transaction", AsyncMock()): + await credit_balance("cashuAtoken", mock_key, mock_session) receive.assert_awaited_once_with( "cashuAtoken", destination_mint=key_mint, destination_unit="sat" @@ -1503,7 +1505,8 @@ async def test_credit_balance_msat_unit_not_converted() -> None: "routstr.wallet.recieve_token", return_value=(1_000_000, "msat", "http://mint:3338"), ): - amount = await credit_balance("cashuAtest", mock_key, mock_session) + with patch("routstr.wallet.store_cashu_transaction", AsyncMock()): + amount = await credit_balance("cashuAtest", mock_key, mock_session) assert amount == 1_000_000 assert mock_session.commit.called