def test_no_word(self, mocker, fake_message): fake_message.text = '/hbd' mock_reply_to = mocker.patch('tululbot.commands.bot.reply_to', autospec=True) hbd(fake_message) mock_reply_to.assert_called_once_with(fake_message, 'Siapa yang ultah?', force_reply=True)
def test_word_only(self, mocker, fake_message): fake_message.text = 'foo bar' greetings_format = ('hoi {}' ' met ultah ya moga sehat dan sukses selalu ' '\U0001F389 \U0001F38A') greetings = greetings_format.format(fake_message.text) mock_send = mocker.patch('tululbot.commands.bot.send_message', autospec=True) hbd(fake_message) mock_send.assert_called_once_with(fake_message.chat.id, greetings)
def test_hbd(self, mocker, fake_message): fake_name = 'Tutu Lulul' fake_message.text = '/hbd {}'.format(fake_name) greetings_format = ('hoi {}' ' met ultah ya moga sehat dan sukses selalu ' '\U0001F389 \U0001F38A') greetings = greetings_format.format(fake_name) mock_send_message = mocker.patch('tululbot.commands.bot.send_message', autospec=True) hbd(fake_message) mock_send_message.assert_called_once_with(fake_message.chat.id, greetings)