Merge pull request #2219 from ChrisLR/add-comms-tests
Adds tests for Channels wholist property
This commit is contained in:
commit
b7fc975379
1 changed files with 32 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from evennia.utils.test_resources import EvenniaTest
|
|
||||||
from evennia import DefaultChannel
|
from evennia import DefaultChannel
|
||||||
from evennia.utils.create import create_message
|
from evennia.utils.create import create_message
|
||||||
|
from evennia.utils.test_resources import EvenniaTest
|
||||||
|
|
||||||
|
|
||||||
class ObjectCreationTest(EvenniaTest):
|
class ObjectCreationTest(EvenniaTest):
|
||||||
|
|
@ -16,3 +16,34 @@ class ObjectCreationTest(EvenniaTest):
|
||||||
msg = create_message("peewee herman", "heh-heh!", header="mail time!")
|
msg = create_message("peewee herman", "heh-heh!", header="mail time!")
|
||||||
self.assertTrue(msg)
|
self.assertTrue(msg)
|
||||||
self.assertEqual(str(msg), "peewee herman->: heh-heh!")
|
self.assertEqual(str(msg), "peewee herman->: heh-heh!")
|
||||||
|
|
||||||
|
|
||||||
|
class ChannelWholistTests(EvenniaTest):
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.default_channel, _ = DefaultChannel.create("coffeetalk", description="A place to talk about coffee.")
|
||||||
|
self.default_channel.connect(self.obj1)
|
||||||
|
|
||||||
|
def test_wholist_shows_subscribed_objects(self):
|
||||||
|
expected = "Obj"
|
||||||
|
result = self.default_channel.wholist
|
||||||
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
|
def test_wholist_shows_none_when_empty(self):
|
||||||
|
# No one hates dogs
|
||||||
|
empty_channel, _ = DefaultChannel.create("doghaters", description="A place where dog haters unite.")
|
||||||
|
expected = "<None>"
|
||||||
|
result = empty_channel.wholist
|
||||||
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
|
def test_wholist_does_not_show_muted_objects(self):
|
||||||
|
self.default_channel.mute(self.obj2)
|
||||||
|
expected = "Obj"
|
||||||
|
result = self.default_channel.wholist
|
||||||
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
|
def test_wholist_shows_connected_object_as_bold(self):
|
||||||
|
self.default_channel.connect(self.char1)
|
||||||
|
expected = "Obj, |wChar|n"
|
||||||
|
result = self.default_channel.wholist
|
||||||
|
self.assertEqual(expected, result)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue