Allows testing when msg is called with a tuple as first argument

This commit is contained in:
Simon Vermeersch 2017-01-22 13:10:59 +01:00 committed by Griatch
parent 4ac863726c
commit 254a746770

View file

@ -70,6 +70,8 @@ class CommandTest(EvenniaTest):
# clean out prettytable sugar. We only operate on text-type
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]
# Get the first element of a tuple if msg received a tuple instead of a string
stored_msg = [smsg[0] if isinstance(smsg, tuple) else smsg for smsg in stored_msg]
returned_msg = "||".join(_RE.sub("", mess) for mess in stored_msg)
returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
if msg is not None: