@@ -55,6 +55,7 @@ async def test_recharge_success():
5555
5656 # Run
5757 mock_session = AsyncMock ()
58+ mock_session .add = MagicMock ()
5859 result = await recharge (mock_session , user_id , amount , upstream_tx_id , note )
5960
6061 # Verify
@@ -147,6 +148,7 @@ async def test_withdraw_success():
147148
148149 # Run
149150 mock_session = AsyncMock ()
151+ mock_session .add = MagicMock ()
150152 result = await withdraw (mock_session , agent_id , amount , upstream_tx_id )
151153
152154 assert result == mock_updated_agent_account
@@ -195,6 +197,7 @@ async def test_reward_success():
195197 mock_deduction .return_value = mock_platform_account
196198
197199 mock_session = AsyncMock ()
200+ mock_session .add = MagicMock ()
198201 await reward (mock_session , user_id , amount , upstream_tx_id )
199202
200203 # Check user income (reward type)
@@ -241,6 +244,7 @@ async def test_adjustment_income():
241244 mock_deduction .return_value = mock_platform_account # Second call for platform
242245
243246 mock_session = AsyncMock ()
247+ mock_session .add = MagicMock ()
244248 await adjustment (
245249 mock_session , user_id , CreditType .PERMANENT , amount , upstream_tx_id , note
246250 )
@@ -289,6 +293,7 @@ async def test_adjustment_expense():
289293 mock_income .return_value = mock_platform_account
290294
291295 mock_session = AsyncMock ()
296+ mock_session .add = MagicMock ()
292297 await adjustment (
293298 mock_session , user_id , CreditType .PERMANENT , amount , upstream_tx_id , note
294299 )
0 commit comments