Beispiel #1
0
	def test_issue66(self):
		chan = Channel('#foobar')
		user1 = User('nick', 'host.com', 'ident')
		chan.add_user(user1)
		user2 = User('nick_', 'host.com', 'ident')
		chan.add_user(user2)
		chan.remove_user(name=user1.nick, identifier=user1.host)
		user2.name = 'nick'
		chan.remove_user(name=user2.nick, identifier=user2.host)
Beispiel #2
0
 def test_issue66(self):
     chan = Channel('#foobar')
     user1 = User('nick', 'host.com', 'ident')
     chan.add_user(user1)
     user2 = User('nick_', 'host.com', 'ident')
     chan.add_user(user2)
     chan.remove_user(name=user1.nick, identifier=user1.host)
     user2.name = 'nick'
     chan.remove_user(name=user2.nick, identifier=user2.host)
Beispiel #3
0
 def test_update_nick(self):
     chan = Channel('#foobar')
     user = User('oldnick', 'host.com', 'ident')
     chan.add_user(user)
     self.assertEqual(user.nick, chan.find_nick_from_host(user.host))
     self.assertEqual(user.host, chan.find_host_from_nick('oldnick'))
     user.name = 'newnick'
     self.assertEqual(None, chan.find_host_from_nick('oldnick'))
     self.assertEqual('newnick', chan.find_nick_from_host(user.host))
     self.assertEqual(user.host, chan.find_host_from_nick('newnick'))
Beispiel #4
0
	def test_update_nick(self):
		chan = Channel('#foobar')
		user = User('oldnick', 'host.com', 'ident')
		chan.add_user(user)
		self.assertEqual(user.nick, chan.find_nick_from_host(user.host))
		self.assertEqual(user.host, chan.find_host_from_nick('oldnick'))
		user.name = 'newnick'
		self.assertEqual(None, chan.find_host_from_nick('oldnick'))
		self.assertEqual('newnick', chan.find_nick_from_host(user.host))
		self.assertEqual(user.host, chan.find_host_from_nick('newnick'))
Beispiel #5
0
 def test_from_ircformat(self):
     strings = ('[email protected]', ':[email protected]')
     for string in strings:
         user = User.from_ircformat('[email protected]')
         self.assertEqual('foo_bar', user.nick)
         self.assertEqual('bar.baz', user.host)
         self.assertEqual('foo', user.ident)
Beispiel #6
0
 def test_add_user(self):
     chan = Channel('#foobar')
     user = User('nick', 'host.com', 'ident')
     chan.add_user(user)
     self.assertEqual(user.nick, chan.find_nick_from_host(user.host))
     self.assertEqual(None, chan.find_nick_from_host('asdsaff'))
     self.assertEqual(user.host, chan.find_host_from_nick(user.nick))
     self.assertEqual(None, chan.find_host_from_nick('asdsaff'))
Beispiel #7
0
	def test_from_ircformat(self):
		strings = (
			'[email protected]',
			':[email protected]'
		)
		for string in strings:
			user = User.from_ircformat('[email protected]')
			self.assertEqual('foo_bar', user.nick)
			self.assertEqual('bar.baz', user.host)
			self.assertEqual('foo', user.ident)
Beispiel #8
0
 def test_remove_user(self):
     chan = Channel('#foobar')
     user = User('nick', 'host.com', 'ident')
     chan.add_user(user)
     self.assertEqual(user.nick, chan.find_nick_from_host(user.host))
     chan.remove_user(identifier=user.host)
     self.assertEqual(None, chan.find_nick_from_host(user.host))
     chan.add_user(user)
     self.assertEqual(user.nick, chan.find_nick_from_host(user.host))
     chan.remove_user(name=user.nick)
     self.assertEqual(None, chan.find_nick_from_host(user.host))
Beispiel #9
0
 def test_strips_tilde(self):
     user = User('foo_bar', 'bar.baz', '~foo')
     self.assertEqual('foo_bar', user.nick)
     self.assertEqual('bar.baz', user.host)
     self.assertEqual('foo', user.ident)