mirror of
https://github.com/evennia/evennia.git
synced 2026-03-23 16:26:30 +01:00
Add simple ContentHandler unit test
This commit is contained in:
parent
74b73c69f9
commit
556091c395
2 changed files with 15 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from evennia.utils.test_resources import EvenniaTest
|
||||
from evennia import DefaultObject, DefaultCharacter, DefaultRoom, DefaultExit
|
||||
from evennia.objects.models import ObjectDB
|
||||
from evennia.utils import create
|
||||
|
||||
|
||||
class DefaultObjectTest(EvenniaTest):
|
||||
|
|
@ -145,3 +146,16 @@ class TestObjectManager(EvenniaTest):
|
|||
self.assertEqual(obj2.attributes.get(key="phrase"), "xyzzy")
|
||||
self.assertEqual(self.obj1.attributes.get(key="phrase", category="adventure"), "plugh")
|
||||
self.assertEqual(obj2.attributes.get(key="phrase", category="adventure"), "plugh")
|
||||
|
||||
class TestContentHandler(EvenniaTest):
|
||||
"Test the ContentHandler (obj.contents)"
|
||||
|
||||
def test_cache_clearing(self):
|
||||
self.assertTrue(self.obj1 in self.room1.contents)
|
||||
self.assertTrue(self.obj2 in self.room1.contents)
|
||||
|
||||
obj3 = create.create_object(key="obj3", location=self.room1)
|
||||
self.assertTrue(obj3 in self.room1.contents)
|
||||
|
||||
obj3.delete()
|
||||
self.assertFalse(obj3 in self.room1.contents)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ def unload_module(module):
|
|||
an object, the module in which that object sits will be unloaded. A string
|
||||
should directly give the module pathname to unload.
|
||||
|
||||
Example:
|
||||
Example:
|
||||
# (in a test method)
|
||||
unload_module(foo)
|
||||
with mock.patch("foo.GLOBALTHING", "mockval"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue