diff --git a/VERSION b/VERSION index e7f1a84..efcb5d0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0+61 \ No newline at end of file +0.1.0+62 \ No newline at end of file diff --git a/bot.py b/bot.py index 9fac1c6..746014f 100644 --- a/bot.py +++ b/bot.py @@ -387,9 +387,6 @@ async def help_navigation(callback: CallbackQuery, state: FSMContext) -> None: message = callback.message if not isinstance(message, Message): return - if await current_mode(state) != "help": - await callback.answer("Сначала открой режим /help.", show_alert=True) - return section = (callback.data or "help:menu").split(":", 1)[1] if not await edit_rich_message( message, diff --git a/tests/test_release_help.py b/tests/test_release_help.py index a96ac87..4a0d0c2 100644 --- a/tests/test_release_help.py +++ b/tests/test_release_help.py @@ -298,7 +298,7 @@ class OnboardingTests(unittest.IsolatedAsyncioTestCase): edit.assert_not_awaited() - async def test_help_callback_is_rejected_outside_help_mode(self): + async def test_help_callback_edits_message_outside_help_mode(self): message = Message( message_id=79, date=datetime.now(), @@ -306,11 +306,15 @@ class OnboardingTests(unittest.IsolatedAsyncioTestCase): ) callback = self._callback("help:posts", message) - with patch.object(bot, "edit_rich_message", new=AsyncMock()) as edit: + with patch.object(bot, "edit_rich_message", new=AsyncMock(return_value=True)) as edit: await bot.help_navigation(callback, _StubState("lobby")) - edit.assert_not_awaited() - callback.answer.assert_awaited_once_with("Сначала открой режим /help.", show_alert=True) + edit.assert_awaited_once_with( + message, + bot.help_view("posts"), + reply_markup=bot.help_inline_keyboard(), + ) + callback.answer.assert_awaited_once_with() def test_welcome_message_has_examples_and_help_handoff(self): from help_message import WELCOME_RICH_HTML, rich_to_plain