mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
test kick/nickClient; make kickClient update channel userlist...
This commit is contained in:
parent
18528c9cab
commit
942f97352d
@ -106,6 +106,10 @@ def kickClient(irc, numeric, channel, target, reason=None):
|
||||
if not reason:
|
||||
reason = 'No reason given'
|
||||
_sendFromUser(irc, numeric, 'KICK %s %s :%s' % (channel, target, reason))
|
||||
# We can pretend the target left by its own will; all we really care about
|
||||
# is that the target gets removed from the channel userlist, and calling
|
||||
# handle_part() does that just fine.
|
||||
handle_part(irc, target, 'KICK', [channel])
|
||||
|
||||
def nickClient(irc, numeric, newnick):
|
||||
"""<irc object> <client numeric> <new nickname>
|
||||
|
@ -71,5 +71,17 @@ class TestInspIRCdProtocol(unittest.TestCase):
|
||||
self.assertNotIn(u, self.irc.servers[self.irc.sid].users)
|
||||
pass
|
||||
|
||||
def testKickClient(self):
|
||||
target = self.proto.spawnClient(self.irc, 'soccerball', 'soccerball', 'abcd').uid
|
||||
self.proto.joinClient(self.irc, target, '#pylink')
|
||||
self.assertIn(self.u, self.irc.channels['#pylink'].users)
|
||||
self.assertIn(target, self.irc.channels['#pylink'].users)
|
||||
self.proto.kickClient(self.irc, self.u, '#pylink', target, 'Pow!')
|
||||
self.assertNotIn(target, self.irc.channels['#pylink'].users)
|
||||
|
||||
def testNickClient(self):
|
||||
self.proto.nickClient(self.irc, self.u, 'NotPyLink')
|
||||
self.assertEqual('NotPyLink', self.irc.users[self.u].nick)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user