@@ -100,6 +100,10 @@ def _make_message(
100100 type(msg ).message_id = PropertyMock (return_value = message_id )
101101 msg .text = text
102102 msg .answer = AsyncMock (return_value = msg )
103+ msg .reply_to_message = None
104+ msg .entities = None
105+ msg .caption = None
106+ msg .caption_entities = None
103107
104108 user = MagicMock (spec = User )
105109 user .id = user_id
@@ -501,7 +505,7 @@ async def test_returns_early_for_none_text(self) -> None:
501505 @patch ("ductor_bot.messenger.telegram.app.strip_mention" , return_value = "clean text" )
502506 async def test_strips_mention_from_text (self , mock_strip : MagicMock ) -> None :
503507 tg_bot , _ = _make_tg_bot ()
504- tg_bot .bot_instance_username = "testbot"
508+ tg_bot ._bot_username = "testbot"
505509 orch = _make_orchestrator ()
506510 tg_bot ._orchestrator = orch
507511
@@ -525,12 +529,30 @@ async def test_strips_mention_from_text(self, mock_strip: MagicMock) -> None:
525529class TestResolveText :
526530 async def test_plain_text_message (self ) -> None :
527531 tg_bot , _ = _make_tg_bot ()
528- tg_bot .bot_instance_username = "mybot"
532+ tg_bot ._bot_username = "mybot"
529533 tg_bot ._orchestrator = _make_orchestrator ()
530534 msg = _make_message (text = "Hello" )
531535 result = await tg_bot ._resolve_text (msg )
532536 assert result == "Hello"
533537
538+ async def test_reply_includes_replied_message_text (self ) -> None :
539+ tg_bot , _ = _make_tg_bot ()
540+ tg_bot ._bot_username = "mybot"
541+ tg_bot ._orchestrator = _make_orchestrator ()
542+
543+ msg = _make_message (text = "@mybot what do you think?" , chat_type = "group" )
544+ reply = MagicMock (spec = Message )
545+ reply .text = "Original message text"
546+ reply .caption = None
547+ msg .reply_to_message = reply
548+
549+ result = await tg_bot ._resolve_text (msg )
550+
551+ assert result == (
552+ "[REPLY TO]\n Original message text\n \n "
553+ "[USER MESSAGE]\n what do you think?"
554+ )
555+
534556 async def test_none_when_no_text_and_no_media (self ) -> None :
535557 tg_bot , _ = _make_tg_bot ()
536558 tg_bot ._orchestrator = _make_orchestrator ()
0 commit comments