fix: Lint fixes of services
All checks were successful
Backend CI / test (push) Successful in 3m59s

This commit is contained in:
JSC
2025-08-01 01:27:47 +02:00
parent 95ccb76233
commit a10111793c
12 changed files with 237 additions and 160 deletions

View File

@@ -168,7 +168,7 @@ class TestCreditService:
mock_socket_manager.send_to_user = AsyncMock()
transaction = await credit_service.deduct_credits(
1, CreditActionType.VLC_PLAY_SOUND, True, {"test": "data"},
1, CreditActionType.VLC_PLAY_SOUND, success=True, metadata={"test": "data"},
)
# Verify user credits were updated
@@ -214,7 +214,7 @@ class TestCreditService:
mock_socket_manager.send_to_user = AsyncMock()
transaction = await credit_service.deduct_credits(
1, CreditActionType.VLC_PLAY_SOUND, False, # Action failed
1, CreditActionType.VLC_PLAY_SOUND, success=False, # Action failed
)
# Verify user credits were NOT updated (action requires success)
@@ -256,7 +256,7 @@ class TestCreditService:
with pytest.raises(InsufficientCreditsError):
await credit_service.deduct_credits(
1, CreditActionType.VLC_PLAY_SOUND, True,
1, CreditActionType.VLC_PLAY_SOUND, success=True,
)
# Verify no socket event was emitted since credits could not be deducted

View File

@@ -45,10 +45,10 @@ class TestRequiresCreditsDecorator:
assert result == "Success: test"
mock_credit_service.validate_and_reserve_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, None,
123, CreditActionType.VLC_PLAY_SOUND,
)
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, True, None,
123, CreditActionType.VLC_PLAY_SOUND, success=True, metadata=None,
)
@pytest.mark.asyncio
@@ -70,10 +70,10 @@ class TestRequiresCreditsDecorator:
await test_action(user_id=123, sound_name="test.mp3")
mock_credit_service.validate_and_reserve_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, {"sound_name": "test.mp3"},
123, CreditActionType.VLC_PLAY_SOUND,
)
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, True, {"sound_name": "test.mp3"},
123, CreditActionType.VLC_PLAY_SOUND, success=True, metadata={"sound_name": "test.mp3"},
)
@pytest.mark.asyncio
@@ -92,7 +92,7 @@ class TestRequiresCreditsDecorator:
assert result is False
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, False, None,
123, CreditActionType.VLC_PLAY_SOUND, success=False, metadata=None,
)
@pytest.mark.asyncio
@@ -111,7 +111,7 @@ class TestRequiresCreditsDecorator:
await test_action(user_id=123)
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, False, None,
123, CreditActionType.VLC_PLAY_SOUND, success=False, metadata=None,
)
@pytest.mark.asyncio
@@ -149,7 +149,7 @@ class TestRequiresCreditsDecorator:
assert result == "test"
mock_credit_service.validate_and_reserve_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, None,
123, CreditActionType.VLC_PLAY_SOUND,
)
@pytest.mark.asyncio
@@ -228,10 +228,10 @@ class TestCreditManager:
manager.mark_success()
mock_credit_service.validate_and_reserve_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, {"test": "data"},
123, CreditActionType.VLC_PLAY_SOUND,
)
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, True, {"test": "data"},
123, CreditActionType.VLC_PLAY_SOUND, success=True, metadata={"test": "data"},
)
@pytest.mark.asyncio
@@ -246,7 +246,7 @@ class TestCreditManager:
pass
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, False, None,
123, CreditActionType.VLC_PLAY_SOUND, success=False, metadata=None,
)
@pytest.mark.asyncio
@@ -261,7 +261,7 @@ class TestCreditManager:
raise ValueError("Test error")
mock_credit_service.deduct_credits.assert_called_once_with(
123, CreditActionType.VLC_PLAY_SOUND, False, None,
123, CreditActionType.VLC_PLAY_SOUND, success=False, metadata=None,
)
@pytest.mark.asyncio