From f9368dd5cc09cf36843c635c8af2d335ed3d1490 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 26 Aug 2019 16:54:27 -0700 Subject: [PATCH] Protocol tests for get_hostmask(), get_friendly_name() --- test/protocol_test_fixture.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/protocol_test_fixture.py b/test/protocol_test_fixture.py index 104eb53..8bf80e8 100644 --- a/test/protocol_test_fixture.py +++ b/test/protocol_test_fixture.py @@ -897,4 +897,17 @@ class BaseProtocolTest(unittest.TestCase): # Check that no users are missing self.assertIn('user%s' % num, all_args) + def test_get_hostmask(self): + u = self._make_user('lorem', 'testUID', ident='ipsum', host='sit.amet') + self.assertEqual(self.p.get_hostmask(u.uid), 'lorem!ipsum@sit.amet') + + def test_get_friendly_name(self): + u = self._make_user('lorem', 'testUID', ident='ipsum', host='sit.amet') + s = self.p.servers['mySID'] = Server(self.p, None, 'irc.example.org') + c = self.p._channels['#abc'] = Channel('#abc') + + self.assertEqual(self.p.get_friendly_name(u.uid), 'lorem') + self.assertEqual(self.p.get_friendly_name('#abc'), '#abc') + self.assertEqual(self.p.get_friendly_name('mySID'), 'irc.example.org') + # TODO: test type coersion if channel or mode targets are ints