diff --git a/evennia/comms/tests.py b/evennia/comms/tests.py index b1ffe4beaf..5ff7377447 100644 --- a/evennia/comms/tests.py +++ b/evennia/comms/tests.py @@ -1,6 +1,6 @@ -from evennia.utils.test_resources import EvenniaTest from evennia import DefaultChannel from evennia.utils.create import create_message +from evennia.utils.test_resources import EvenniaTest class ObjectCreationTest(EvenniaTest): @@ -16,3 +16,34 @@ class ObjectCreationTest(EvenniaTest): msg = create_message("peewee herman", "heh-heh!", header="mail time!") self.assertTrue(msg) 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 = "" + 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)