示例#1
0
	def test_update_nick(self):
		chan = Channel('#foobar')
		usr = User('oldnick', '*****@*****.**')
		chan.add_user(usr)
		self.assertEqual(usr.nick, chan.find_nick_from_host(usr.host))
		self.assertEqual(usr.host, chan.find_host_from_nick('oldnick'))
		chan.update_nick('oldnick', 'newnick')
		self.assertEqual(False, chan.find_host_from_nick('oldnick'))
		self.assertEqual('newnick', chan.find_nick_from_host(usr.host))
		self.assertEqual(usr.host, chan.find_host_from_nick('newnick'))
示例#2
0
	def test_add_user(self):
		chan = Channel('#foobar')
		usr = User('nick', '*****@*****.**')
		chan.add_user(usr)
		self.assertEqual(usr.nick, chan.host_map[usr.host])
		self.assertEqual(usr.host, chan.nick_map[usr.nick])
		self.assertEqual(usr.nick, chan.find_nick_from_host(usr.host))
		self.assertEqual(False, chan.find_nick_from_host('asdsaff'))
		self.assertEqual(usr.host, chan.find_host_from_nick(usr.nick))
		self.assertEqual(False, chan.find_host_from_nick('asdsaff'))