diff --git a/test/protocol_test_fixture.py b/test/protocol_test_fixture.py index 4ebd100..8be0cbc 100644 --- a/test/protocol_test_fixture.py +++ b/test/protocol_test_fixture.py @@ -390,6 +390,45 @@ class BaseProtocolTest(unittest.TestCase): "Second ban should have been removed (different case)" ) + def test_parse_mode_channel_prefixmode_has_nick(self): + c = self.p.channels['#'] = Channel(self.p, name='#') + u = self._make_user('mynick', uid='myuid') + c.users.add(u) + u.channels.add(c) + + self.assertEqual( + self.p.parse_modes('#', ['+o', 'myuid']), + [('+o', 'myuid')], + "+o on UID should be registered" + ) + self.assertEqual( + self.p.parse_modes('#', ['+o', 'mynick']), + [('+o', 'myuid')], + "+o on nick should be registered" + ) + self.assertEqual( + self.p.parse_modes('#', ['+o', 'MyUiD']), + [], + "+o on wrong case UID should be ignored" + ) + self.assertEqual( + self.p.parse_modes('#', ['+o', 'MyNick']), + [('+o', 'myuid')], + "+o on different case nick should be registered" + ) + + self.assertEqual( + self.p.parse_modes('#', ['-o', 'myuid']), + [('-o', 'myuid')], + "-o on UID should be registered" + ) + self.assertEqual( + self.p.parse_modes('#', ['-o', 'mynick']), + [('-o', 'myuid')], + "-o on nick should be registered" + ) + + def test_parse_modes_user_rfc(self): u = self._make_user('testuser', uid='100') diff --git a/test/test_protocol_clientbot.py b/test/test_protocol_clientbot.py new file mode 100644 index 0000000..370e3a7 --- /dev/null +++ b/test/test_protocol_clientbot.py @@ -0,0 +1,18 @@ +import unittest + +from pylinkirc.protocols import clientbot +from pylinkirc.classes import User + +import protocol_test_fixture as ptf + +class UnrealProtocolTest(ptf.BaseProtocolTest): + proto_class = clientbot.ClientbotWrapperProtocol + + def setUp(self): + super().setUp() + self.p.pseudoclient = self._make_user('PyLink', uid='ClientbotInternal@0') + + # In the future we will have protocol specific test cases here + +if __name__ == '__main__': + unittest.main()