Add a @spawn unit test
Tests the @spawn command and its variations. The test is designed to aslo check the properties of the spawned objects for some common/obvious settings. Test also adds a new prototypes file to be used with the Evennia unit tester for any tests that require named prototypes. The spawner test requires testing named prototypes, so it is added in this change.
This commit is contained in:
parent
a994fd3c63
commit
b6649bcef8
3 changed files with 91 additions and 0 deletions
20
evennia/utils/test_prototypes.py
Normal file
20
evennia/utils/test_prototypes.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"""
|
||||
test_prototypes
|
||||
|
||||
This is meant to be used with Evennia unittest framework
|
||||
to provide some named prototypes for use with various tests
|
||||
(for example commands that accept named prototypes, not just
|
||||
prototype dictionaries)
|
||||
"""
|
||||
|
||||
GOBLIN = {
|
||||
"key" : "Goblin", \
|
||||
"typeclass" : "DefaultCharacter", \
|
||||
"desc" : "A goblin."
|
||||
}
|
||||
|
||||
BALL = {
|
||||
"key" : "Ball", \
|
||||
"typeclass" : "DefaultObject", \
|
||||
"desc" : "A ball."
|
||||
}
|
||||
|
|
@ -34,6 +34,8 @@ class EvenniaTest(TestCase):
|
|||
self.room1 = create.create_object(self.room_typeclass, key="Room", nohome=True)
|
||||
self.room1.db.desc = "room_desc"
|
||||
settings.DEFAULT_HOME = "#%i" % self.room1.id # we must have a default home
|
||||
# Set up fake prototype module for allowing tests to use named prototypes.
|
||||
settings.PROTOTYPE_MODULES = "evennia.utils.test_prototypes"
|
||||
self.room2 = create.create_object(self.room_typeclass, key="Room2")
|
||||
self.exit = create.create_object(self.exit_typeclass, key='out', location=self.room1, destination=self.room2)
|
||||
self.obj1 = create.create_object(self.object_typeclass, key="Obj", location=self.room1, home=self.room1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue