示例#1
0
    def test_edited_message_disallow(self):
        query = BotQuery()
        query.is_edited = True
        help_command = HelpCommand(query)
        self.assertTrue(help_command.skip_edited())

        help_command.handle_normal_query = Mock()
        help_command.execute()
        self.assertFalse(help_command.handle_normal_query.called)
示例#2
0
    def test_edited_message_disallow(self):
        query = BotQuery()
        query.is_edited = True
        invalid_command = InvalidCommand(query)
        self.assertTrue(invalid_command.skip_edited())

        invalid_command.handle_normal_query = Mock()
        invalid_command.execute()
        self.assertFalse(invalid_command.handle_normal_query.called)
示例#3
0
    def test_edited_message_allow(self):
        query = BotQuery()
        query.is_edited = True
        start_command = StartCommand(query)
        start_command.ignore_edited = False

        self.assertFalse(start_command.skip_edited())
        start_command.handle_normal_query = Mock()
        start_command.execute()
        start_command.handle_normal_query.assert_called_once_with(
            "Greetings from the DAS bot!")
示例#4
0
    def test_edited_message_allow(self):
        query = BotQuery()
        query.is_edited = True
        invalid_command = InvalidCommand(query)
        invalid_command.ignore_edited = False
        self.assertFalse(invalid_command.skip_edited())

        invalid_command.handle_normal_query = Mock()
        invalid_command.execute()
        invalid_command.handle_normal_query.assert_called_once_with(
            "Sorry! I don't understand. Try /help")