Exemplo n.º 1
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"))
Exemplo n.º 2
0
 def join(self, nick, is_admin=False, channel=None):
     user = self._create_user(nick, is_admin)
     if channel and not isinstance(channel, irc.Channel):
         channel = irc.Channel(channel)
     for join in self.plugin.joins:
         ret = join(user, channel)
         if ret:
             return ret
Exemplo n.º 3
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'))
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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"))
Exemplo n.º 7
0
 def setUp(self):
     self.channel = irc.Channel("#test")
     self.bot = bot.Bot({
         "storage_dir": "/tmp/botologist",
         "bot": {
             "server": "localhost:6667"
         }
     })
     self.bot.config.update(self.cfg)
     self.plugin = self.create_plugin()
Exemplo 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'))
Exemplo n.º 9
0
 def setUp(self):
     self.channel = irc.Channel('#test')
     self.bot = bot.Bot({
         'storage_dir': '/tmp/botologist',
         'bot': {
             'server': 'localhost:6667',
         },
     })
     self.bot.config.update(self.cfg)
     self.plugin = self.create_plugin()
Exemplo 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))
Exemplo n.º 11
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))
Exemplo n.º 12
0
def make_channel(channel):
    return irc.Channel(channel)
Exemplo n.º 13
0
 def test_init(self):
     chan = irc.Channel("#foobar")
     self.assertEqual("#foobar", chan.name)
     chan = irc.Channel("foobar")
     self.assertEqual("#foobar", chan.name)
Exemplo n.º 14
0
 def test_init(self):
     chan = irc.Channel('#foobar')
     self.assertEqual('#foobar', chan.name)
     chan = irc.Channel('foobar')
     self.assertEqual('#foobar', chan.name)