示例#1
0
    def assertMessageContainsCommand(self, nickname, trigger, message,
                                     expected_command_string):
        conf = {
            'akumabot.admins': set(),
            'akumabot.nickname': nickname,
            'commands.trigger': trigger,
        }
        bot = FakeBot(conf)
        cmdproc = CommandProcessor(bot)

        result = cmdproc._detect_command(message)
        if result is None:
            raise AssertionError(
                'No command was found in message {0!r}'.format(message))
        command_string = result
        if command_string != expected_command_string:
            raise AssertionError(
                'Got command string {0!r} but expected {1!r} '
                'in message {2!r}'.format(
                    command_string, expected_command_string, message))