3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

parse_modes: test combinations of nicks and UIDs in prefix modes

This commit is contained in:
James Lu 2019-08-23 21:23:43 -07:00
parent c1dbfdab48
commit 27eed3334b
2 changed files with 57 additions and 0 deletions

View File

@ -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')

View File

@ -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()