mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 08:57:25 +01:00 
			
		
		
		
	parse_modes: test combinations of nicks and UIDs in prefix modes
This commit is contained in:
		
							parent
							
								
									c1dbfdab48
								
							
						
					
					
						commit
						27eed3334b
					
				@ -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')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								test/test_protocol_clientbot.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/test_protocol_clientbot.py
									
									
									
									
									
										Normal 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()
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user