def test_no_hotline_message_id_set(self, fake_message, mocker): fake_message.text = '/hotline' mocker.patch('tululbot.commands.HOTLINE_MESSAGE_ID', None) mock_forward_message = mocker.patch('tululbot.commands.bot.forward_message', autospec=True) hotline(fake_message) assert not mock_forward_message.called
def test_hotline(fake_message, mocker): fake_message.text = '/hotline' mock_hotline_message_id = mocker.patch('tululbot.commands.HOTLINE_MESSAGE_ID') mock_forward_message = mocker.patch('tululbot.commands.bot.forward_message') hotline(fake_message) mock_forward_message.assert_called_once_with( fake_message.chat.id, fake_message.chat.id, mock_hotline_message_id )
def test_hotline(self, fake_message, mocker): fake_message.text = '/hotline' fake_hotline_message_id = 123 mocker.patch('tululbot.commands.HOTLINE_MESSAGE_ID', fake_hotline_message_id) mock_forward_message = mocker.patch('tululbot.commands.bot.forward_message', autospec=True) hotline(fake_message) mock_forward_message.assert_called_once_with(fake_message.chat.id, fake_message.chat.id, fake_hotline_message_id)