Fix: Correct asyncio.sleep call count in long message test
This commit is contained in:
@@ -146,8 +146,10 @@ class TestTelegramHelper(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
with patch('asyncio.sleep', new_callable=AsyncMock) as mock_sleep:
|
||||
await self.telegram_helper.handle_message(self.mock_update, self.mock_context)
|
||||
# Initial call + two chunks
|
||||
# Initial call to reply_text + two chunks sent via reply_text
|
||||
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
|
||||
|
||||
@patch.object(TelegramHelper, '_handle_message_logic', new_callable=AsyncMock)
|
||||
|
||||
Reference in New Issue
Block a user