def test_create_types(self): self.assert_response("create muss.db.Container box", endswith=", box.") box = db.find(lambda x: x.name == "box") self.assertIsInstance(box, db.Container) self.assertEqual(box.location, self.player) self.assert_response("create muss.equipment.Equipment snake", endswith=", snake.") snake = db.find(lambda x: x.name == "snake") self.assertIsInstance(snake, equipment.Equipment) self.assertEqual(snake.location, self.player)
def test_connected_attr(self): self.proto.dataReceived("new\r\nname\r\npass\r\npass\r\n") self.proto.connectionLost(reason=None) self.new_connection() self.tr.clear() player = db.find(lambda x: x.name == "name") self.assertTrue(not player.connected) self.assert_response("name pass\r\n", startswith="Hello, name!\r\n\r\n") self.assertTrue(player.connected) self.proto.dataReceived("quit\r\n") self.assertTrue(player.connected)