Ejemplo n.º 1
0
    def test_reply_to_with_preview_disabled(self, mocker, fake_message):
        bot = TululBot('TOKEN')
        mock_reply_to = mocker.patch.object(bot._telebot, 'reply_to', autospec=True)
        text = 'Hello world'

        bot.reply_to(fake_message, text, disable_preview=True)

        mock_reply_to.assert_called_once_with(fake_message, text,
                                              disable_web_page_preview=True,
                                              reply_markup=None)
Ejemplo n.º 2
0
    def test_reply_to_with_force_reply(self, mocker, fake_message):
        bot = TululBot('TOKEN')
        mock_reply_to = mocker.patch.object(bot._telebot, 'reply_to', autospec=True)
        text = 'dummy text'

        bot.reply_to(fake_message, text, force_reply=True)

        args, kwargs = mock_reply_to.call_args
        assert args == (fake_message, text)
        assert len(kwargs) == 2
        assert 'disable_web_page_preview' in kwargs
        assert not kwargs['disable_web_page_preview']
        assert 'reply_markup' in kwargs
        assert isinstance(kwargs['reply_markup'], types.ForceReply)
Ejemplo n.º 3
0
    def test_reply_to(self, mocker, fake_message):
        bot = TululBot('TOKEN')
        return_value = 'some return value'
        mock_reply_to = mocker.patch.object(bot._telebot, 'reply_to',
                                            return_value=return_value,
                                            autospec=True)
        text = 'Hello world'

        rv = bot.reply_to(fake_message, text)

        assert rv == return_value
        mock_reply_to.assert_called_once_with(fake_message, text,
                                              disable_web_page_preview=False,
                                              reply_markup=None)