Skip to content

Commit eb96335

Browse files
committed
fix: test issue
1 parent 8e6da8a commit eb96335

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tests/core/test_credit.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
)

tests/models/test_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async def sqlite_engine():
1919
db_module.engine = test_engine
2020

2121
async with test_engine.begin() as conn:
22-
await conn.run_sync(Base.metadata.create_all)
22+
await conn.run_sync(Base.metadata.create_all, tables=[UserTable.__table__])
2323

2424
try:
2525
yield test_engine

0 commit comments

Comments
 (0)