feat: show main menu with version notice
This commit is contained in:
1 parent
b665bf3394
commit
04b33e708d
3 files changed
+36
-13
No files matched your search
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from typing import Any, cast
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aiogram.types import Chat, Message
|
||||
@@ -27,6 +28,7 @@ class _StubState:
|
||||
class DeployNoticeTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_sends_once_per_new_version_only_in_development(self):
|
||||
fake_bot = AsyncMock()
|
||||
state = _StubState("generation")
|
||||
with (
|
||||
patch.object(bot, "DEPLOY_ENV", "development"),
|
||||
patch.object(bot, "VERSION", "0.1.0+5"),
|
||||
@@ -35,9 +37,14 @@ class DeployNoticeTests(unittest.IsolatedAsyncioTestCase):
|
||||
patch.object(bot, "set_deploy_notice_version"),
|
||||
patch.object(bot.asyncio, "to_thread", new=AsyncMock(side_effect=["0.1.0+4", None, "0.1.0+5"])),
|
||||
):
|
||||
await bot.notify_development_deploy(fake_bot)
|
||||
await bot.notify_development_deploy(fake_bot)
|
||||
fake_bot.send_message.assert_awaited_once_with(chat_id=2201809732, text="🚀 Бот обновлён\nВерсия: 0.1.0+5")
|
||||
self.assertTrue(await bot.notify_development_deploy(fake_bot, cast(Any, state), 2201809732))
|
||||
self.assertFalse(await bot.notify_development_deploy(fake_bot))
|
||||
fake_bot.send_message.assert_awaited_once_with(
|
||||
chat_id=2201809732,
|
||||
text="🚀 Бот обновлён\nВерсия: 0.1.0+5",
|
||||
reply_markup=bot.main_menu_keyboard(),
|
||||
)
|
||||
self.assertEqual(state.value, bot.BotMode.lobby.state)
|
||||
|
||||
async def test_does_not_send_outside_development(self):
|
||||
fake_bot = AsyncMock()
|
||||
|
||||
Reference in new issue
Block a user