As an exercise, in order to try to better understand how to make good use of unit testing, I copied just the following code from the built-in evennia tests and put it into my own test module under the "commands" directory.
class TestAccount(CommandTest):
"""Emulate the built-in test"""
def test_ooc(self):
self.call(account.CmdOOC(), "", "You go OOC.", caller=self.account)
def test_ic(self):
self.account.db._playable_characters = [self.char1]
self.account.unpuppet_object(self.session)
self.call(
account.CmdIC(), "Obj", "You become Char.",
caller=self.account,
receiver=self.char1)
The first test "ooc" works but the second fails as follows.
AssertionError:
=================Wanted message=======================
You become Char.
================Returned message======================
======================================================
In game (using my own db) however both commands work as expected:
>ooc
You go OOC.
You are out-of-character (OOC).
Use ic to get back into the game.
>ic
You become Char.
All this is to say I feel stumped. If I can't even get built in tests to work as expected I an a long way from being able to test my custom commands. I don't suppose this is a problem with the testing suite but a problem of my own understanding. However I'm really not sure where to go from here. Any advice, whether general or particular would be appreciated.
Thanks