Esempio n. 1
0
 def test_issue66(self):
     chan = irc.Channel('#foobar')
     user1 = irc.User('nick', 'host.com', 'ident')
     chan.add_user(user1)
     user2 = irc.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)
Esempio n. 2
0
 def test_issue66(self):
     chan = irc.Channel("#foobar")
     user1 = irc.User("nick", "host.com", "ident")
     chan.add_user(user1)
     user2 = irc.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)
Esempio n. 3
0
 def test_only_returns_online_admins(self):
     bot = self.make_bot()
     bot.admins = ['admin1.com']
     chan = make_channel('#chan')
     bot.add_channel(chan)
     self.assertEqual(set(), bot.get_admin_nicks())
     chan.add_user(irc.User('admin1', 'admin1.com'))
     self.assertEqual({'admin1'}, bot.get_admin_nicks())
Esempio n. 4
0
 def test_add_user(self):
     chan = irc.Channel("#foobar")
     user = irc.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"))
Esempio n. 5
0
 def test_add_user(self):
     chan = irc.Channel('#foobar')
     user = irc.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'))
Esempio n. 6
0
 def test_only_returns_online_admins(self):
     bot = self.make_bot()
     bot.admins = ["admin1.com"]
     chan = make_channel("#chan")
     bot.add_channel(chan)
     self.assertEqual(set(), bot.get_admin_nicks())
     chan.add_user(irc.User("admin1", "admin1.com"))
     self.assertEqual({"admin1"}, bot.get_admin_nicks())
Esempio n. 7
0
 def test_update_nick(self):
     chan = irc.Channel("#foobar")
     user = irc.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"))
Esempio n. 8
0
 def test_update_nick(self):
     chan = irc.Channel('#foobar')
     user = irc.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'))
Esempio n. 9
0
 def test_remove_user(self):
     chan = irc.Channel("#foobar")
     user = irc.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))
Esempio n. 10
0
 def test_remove_user(self):
     chan = irc.Channel('#foobar')
     user = irc.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))
Esempio n. 11
0
 def test_strips_tilde(self):
     user = irc.User("foo_bar", "bar.baz", "~foo")
     self.assertEqual("foo_bar", user.nick)
     self.assertEqual("bar.baz", user.host)
     self.assertEqual("foo", user.ident)
Esempio n. 12
0
 def _create_user(self, nick, host=None, is_admin=False):
     user = irc.User(nick, host=host)
     user.is_admin = is_admin
     return user
Esempio n. 13
0
 def test_strips_tilde(self):
     user = irc.User('foo_bar', 'bar.baz', '~foo')
     self.assertEqual('foo_bar', user.nick)
     self.assertEqual('bar.baz', user.host)
     self.assertEqual('foo', user.ident)