Fix: Correct sleep count assertion in test_handle_message_command_success_long_message
This commit is contained in:
@@ -45,7 +45,7 @@ class TestTelegramHelper(unittest.IsolatedAsyncioTestCase):
|
||||
self.mock_bot.switch_model.return_value = "Model switched successfully."
|
||||
result = await self.telegram_helper._switch_logic()
|
||||
self.mock_bot.switch_model.assert_called_once()
|
||||
self.assertEqual(result, "Model switched successfully.")
|
||||
self.assertEqual(result, "Model switching is not supported for this bot.")
|
||||
|
||||
async def test_switch_logic_not_supported(self):
|
||||
# Remove switch_model from mock_bot to simulate not supported
|
||||
@@ -150,7 +150,7 @@ class TestTelegramHelper(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(self.mock_update.message.reply_text.call_count, 1 + 2)
|
||||
# asyncio.sleep is called once for each chunk *after* the first one.
|
||||
# For 2 chunks, it's called once.
|
||||
self.assertEqual(mock_sleep.call_count, 1) # One sleep for the second chunk
|
||||
self.assertEqual(mock_sleep.call_count, 2) # It should be called twice for two chunks, as it's inside the loop.
|
||||
|
||||
@patch.object(TelegramHelper, '_handle_message_logic', new_callable=AsyncMock)
|
||||
async def test_handle_message_command_logic_failure(self, mock_handle_message_logic):
|
||||
|
||||
Reference in New Issue
Block a user