def setUp(self): if 'bob' in NamedObject._name_registry: del NamedObject._name_registry['bob'] self.telnet = MockTelnet() self.avatar = self.telnet.avatar = \ Player("bob", "", set(), grailmud.instance.startroom, '') self.ah = AvatarHandler(self.telnet, self.avatar)
def test_AvatarHandler_initialisation_calls_login(): def fake_login(actor): actor.login_called = True login(actor) from grailmud.actiondefs.login import login from grailmud import telnet telnet.login = fake_login mocktelnet = MockTelnet() avatar = mocktelnet.avatar = Player("michael", "", set(), grailmud.instance.startroom, '') ah = AvatarHandler(mocktelnet, avatar) assert avatar.login_called