'Test a command by assigning all the needed
properties to cmdobj and  running
cmdobj.at_pre_cmd()
cmdobj.parse()
cmdobj.func()
cmdobj.at_post_cmd()
The msgreturn value is compared to eventual
output sent to caller.msg in the game
Returns:
msg (str): The received message that was sent to the caller.'

def call(self, cmdobj, args, msg=None, cmdset=None, noansi=True, caller=None, receiver=None, cmdstring=None, obj=None):

    caller = (caller if caller else self.char1)
    receiver = (receiver if receiver else caller)
    cmdobj.caller = caller
    cmdobj.cmdstring = (cmdstring if cmdstring else cmdobj.key)
    cmdobj.args = args
    cmdobj.cmdset = cmdset
    cmdobj.session = SESSIONS.session_from_sessid(1)
    cmdobj.player = self.player
    cmdobj.raw_string = ((cmdobj.key + '    ') + args)
    cmdobj.obj = (obj or (caller if caller else self.char1))
    old_msg = receiver.msg
    returned_msg = ''
    try:
        receiver.msg = Mock()
        cmdobj.at_pre_cmd()
        cmdobj.parse()
        cmdobj.func()
        cmdobj.at_post_cmd()
    except InterruptCommand:
        pass
    finally:
        stored_msg = [(args[0] if (args and args[0]) else kwargs.get('text', utils.to_str(kwargs, force_string=True))) for (name, args, kwargs) in receiver.msg.mock_calls]
        stored_msg = [(smsg[0] if isinstance(smsg, tuple) else smsg) for smsg in stored_msg]
        if (msg is not None):
            returned_msg = '||'.join((_RE.sub('', mess) for mess in stored_msg))
            returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
            if (((msg == '') and returned_msg) or (not returned_msg.startswith(msg.strip()))):
                sep1 = (((('\n' + ('=' * 30)) + 'Wanted    message') + ('=' * 34)) + '\n')
                sep2 = (((('\n' + ('=' * 30)) + 'Returned    message') + ('=' * 32)) + '\n')
                sep3 = ('\n' + ('=' * 78))
                retval = ((((sep1 + msg.strip()) + sep2) + returned_msg) + sep3)
                raise AssertionError(retval)
        else:
            returned_msg = '\n'.join((str(msg) for msg in stored_msg))
            returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
        receiver.msg = old_msg
    return returned_msg
