Made some changes to the tests. All tests doesn't clear at the moment, seems to be something weird in the test system itself though, rather than an actual problem in the core. For example the test system reports an error with the @desc command that I cannot reproduce when testing that command for real in the game ...
This commit is contained in:
parent
8ad4f4a9fc
commit
4ce750d1ee
1 changed files with 31 additions and 72 deletions
|
|
@ -37,7 +37,6 @@ VERBOSE = True
|
||||||
NOMANGLE = True # mangle command input for extra testing
|
NOMANGLE = True # mangle command input for extra testing
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
print "cleaning test database ..."
|
|
||||||
User.objects.all().delete()
|
User.objects.all().delete()
|
||||||
PlayerDB.objects.all().delete()
|
PlayerDB.objects.all().delete()
|
||||||
ObjectDB.objects.all().delete()
|
ObjectDB.objects.all().delete()
|
||||||
|
|
@ -46,7 +45,6 @@ def cleanup():
|
||||||
PlayerChannelConnection.objects.all().delete()
|
PlayerChannelConnection.objects.all().delete()
|
||||||
ExternalChannelConnection.objects.all().delete()
|
ExternalChannelConnection.objects.all().delete()
|
||||||
ServerConfig.objects.all().delete()
|
ServerConfig.objects.all().delete()
|
||||||
cleanup()
|
|
||||||
|
|
||||||
class FakeSessionHandler(sessionhandler.ServerSessionHandler):
|
class FakeSessionHandler(sessionhandler.ServerSessionHandler):
|
||||||
"""
|
"""
|
||||||
|
|
@ -115,77 +113,38 @@ class CommandTest(TestCase):
|
||||||
|
|
||||||
Inherit new tests from this.
|
Inherit new tests from this.
|
||||||
"""
|
"""
|
||||||
print "creating command testing objects ..."
|
|
||||||
ROOM1 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room1")
|
|
||||||
ROOM2 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room2")
|
|
||||||
# create a faux player/character for testing.
|
|
||||||
CHAR1 = create.create_player("TestChar", "testplayer@test.com", "testpassword", character_location=ROOM1)
|
|
||||||
CHAR1.player.user.is_superuser = True
|
|
||||||
CHAR1.lock_storage = ""
|
|
||||||
CHAR1.locks = LockHandler(CHAR1)
|
|
||||||
CHAR1.ndb.return_string = None
|
|
||||||
sess = FakeSession()
|
|
||||||
sess.connectionMade()
|
|
||||||
sess.session_login(CHAR1.player)
|
|
||||||
# create second player
|
|
||||||
CHAR2 = create.create_player("TestChar2", "testplayer2@test.com", "testpassword2", character_location=ROOM1)
|
|
||||||
CHAR2.player.user.is_superuser = False
|
|
||||||
CHAR2.lock_storage = ""
|
|
||||||
CHAR2.locks = LockHandler(CHAR2)
|
|
||||||
CHAR2.ndb.return_string = None
|
|
||||||
sess2 = FakeSession()
|
|
||||||
sess2.connectionMade()
|
|
||||||
sess2.session_login(CHAR2.player)
|
|
||||||
# A non-player-controlled character
|
|
||||||
CHAR3 = create.create_object(settings.BASE_CHARACTER_TYPECLASS, key="TestChar3", location=ROOM1)
|
|
||||||
# create some objects
|
|
||||||
OBJ1 = create.create_object(settings.BASE_OBJECT_TYPECLASS, key="obj1", location=ROOM1)
|
|
||||||
OBJ2 = create.create_object(settings.BASE_OBJECT_TYPECLASS, key="obj2", location=ROOM1)
|
|
||||||
EXIT1 = create.create_object(settings.BASE_EXIT_TYPECLASS, key="exit1", location=ROOM1)
|
|
||||||
EXIT2 = create.create_object(settings.BASE_EXIT_TYPECLASS, key="exit2", location=ROOM2)
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"sets up the testing environment"
|
"sets up the testing environment"
|
||||||
#ServerConfig.objects.conf("default_home", 2)
|
#ServerConfig.objects.conf("default_home", 2)
|
||||||
|
self.addCleanup(cleanup)
|
||||||
self.room1 = self.ROOM1
|
self.room1 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room1")
|
||||||
self.room2 = self.ROOM2
|
self.room2 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room2")
|
||||||
self.char1 = self.CHAR1
|
# create a faux player/character for testing.
|
||||||
self.char2 = self.CHAR2
|
self.char1 = create.create_player("TestChar", "testplayer@test.com", "testpassword", character_location=self.room1)
|
||||||
self.char3 = self.CHAR3
|
self.char1.player.user.is_superuser = True
|
||||||
self.obj1 = self.OBJ1
|
self.char1.lock_storage = ""
|
||||||
self.obj2 = self.OBJ2
|
self.char1.locks = LockHandler(self.char1)
|
||||||
self.exit1 = self.EXIT1
|
self.char1.ndb.return_string = None
|
||||||
self.exit2 = self.EXIT2
|
self.sess1 = FakeSession()
|
||||||
|
self.sess1.connectionMade()
|
||||||
#self.addCleanup(cleanup)
|
self.sess1.session_login(self.char1.player)
|
||||||
#self.room1 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room1")
|
# create second player
|
||||||
#self.room2 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room2")
|
self.char2 = create.create_player("TestChar2", "testplayer2@test.com", "testpassword2", character_location=self.room1)
|
||||||
## create a faux player/character for testing.
|
self.char2.player.user.is_superuser = False
|
||||||
#self.char1 = create.create_player("TestChar", "testplayer@test.com", "testpassword", character_location=self.room1)
|
self.char2.lock_storage = ""
|
||||||
#self.char1.player.user.is_superuser = True
|
self.char2.locks = LockHandler(self.char2)
|
||||||
#self.char1.lock_storage = ""
|
self.char2.ndb.return_string = None
|
||||||
#self.char1.locks = LockHandler(self.char1)
|
self.sess2 = FakeSession()
|
||||||
#self.char1.ndb.return_string = None
|
self.sess2.connectionMade()
|
||||||
#sess = FakeSession()
|
self.sess2.session_login(self.char2.player)
|
||||||
#sess.connectionMade()
|
# A non-player-controlled character
|
||||||
#sess.session_login(self.char1.player)
|
self.char3 = create.create_object(settings.BASE_CHARACTER_TYPECLASS, key="TestChar3", location=self.room1)
|
||||||
## create second player
|
# create some objects
|
||||||
#self.char2 = create.create_player("TestChar2", "testplayer2@test.com", "testpassword2", character_location=self.room1)
|
self.obj1 = create.create_object(settings.BASE_OBJECT_TYPECLASS, key="obj1", location=self.room1)
|
||||||
#self.char2.player.user.is_superuser = False
|
self.obj2 = create.create_object(settings.BASE_OBJECT_TYPECLASS, key="obj2", location=self.room1)
|
||||||
#self.char2.lock_storage = ""
|
self.exit1 = create.create_object(settings.BASE_EXIT_TYPECLASS, key="exit1", location=self.room1)
|
||||||
#self.char2.locks = LockHandler(self.char2)
|
self.exit2 = create.create_object(settings.BASE_EXIT_TYPECLASS, key="exit2", location=self.room2)
|
||||||
#self.char2.ndb.return_string = None
|
|
||||||
#sess2 = FakeSession()
|
|
||||||
#sess2.connectionMade()
|
|
||||||
#sess2.session_login(self.char2.player)
|
|
||||||
## A non-player-controlled character
|
|
||||||
#self.char3 = create.create_object(settings.BASE_CHARACTER_TYPECLASS, key="TestChar3", location=self.room1)
|
|
||||||
## create some objects
|
|
||||||
#self.obj1 = create.create_object(settings.BASE_OBJECT_TYPECLASS, key="obj1", location=self.room1)
|
|
||||||
#self.obj2 = create.create_object(settings.BASE_OBJECT_TYPECLASS, key="obj2", location=self.room1)
|
|
||||||
#self.exit1 = create.create_object(settings.BASE_EXIT_TYPECLASS, key="exit1", location=self.room1)
|
|
||||||
#self.exit2 = create.create_object(settings.BASE_EXIT_TYPECLASS, key="exit2", location=self.room2)
|
|
||||||
|
|
||||||
def get_cmd(self, cmd_class, argument_string=""):
|
def get_cmd(self, cmd_class, argument_string=""):
|
||||||
"""
|
"""
|
||||||
|
|
@ -443,15 +402,15 @@ class TestOpen(BuildTest):
|
||||||
def test_call(self):
|
def test_call(self):
|
||||||
self.execute_cmd("@dig room4;roomalias4")
|
self.execute_cmd("@dig room4;roomalias4")
|
||||||
self.execute_cmd("@open testexit4;aliasexit4 = roomalias4", "Created new Exit")
|
self.execute_cmd("@open testexit4;aliasexit4 = roomalias4", "Created new Exit")
|
||||||
class TestScript(BuildTest):
|
class TestTypeclass(BuildTest):
|
||||||
def test_call(self):
|
def test_call(self):
|
||||||
self.execute_cmd("@typeclass obj1 = src.objects.objects.Character", "obj's type is now")
|
self.execute_cmd("@typeclass obj1 = src.objects.objects.Character", "obj's type is now")
|
||||||
self.assertEqual(self.obj1.db_typeclass_path, u"src.objects.objects.Character")
|
self.assertEqual(self.obj1.db_typeclass_path, u"src.objects.objects.Character")
|
||||||
class TestScript(BuildTest):
|
class TestSet(BuildTest):
|
||||||
def test_call(self):
|
def test_call(self):
|
||||||
self.execute_cmd("@set box1/test = value")
|
self.execute_cmd("@set box1/test = value")
|
||||||
self.execute_cmd("@wipe box1", "Wiped")
|
self.execute_cmd("@wipe box1", "Wiped")
|
||||||
self.assertEqual(self.obj1.db.all(), [])
|
self.assertEqual(self.obj1.db.all, [])
|
||||||
class TestLock(BuildTest):
|
class TestLock(BuildTest):
|
||||||
# lock functionality itseld is tested separately
|
# lock functionality itseld is tested separately
|
||||||
def test_call(self):
|
def test_call(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue