def testFirstCommands(self): try: originalNick = conf.supybot.nick() originalUser = conf.supybot.user() originalPassword = conf.supybot.networks.test.password() nick = 'nick' conf.supybot.nick.setValue(nick) user = '******' conf.supybot.user.setValue(user) expected = [ ircmsgs.IrcMsg(command='CAP', args=('LS', '302')), ircmsgs.nick(nick), ircmsgs.user('limnoria', user), ] irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] is not None: msgs.append(irc.takeMsg()) msgs.pop() self.assertEqual(msgs, expected) password = '******' conf.supybot.networks.test.password.setValue(password) irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] is not None: msgs.append(irc.takeMsg()) msgs.pop() expected.insert(1, ircmsgs.password(password)) self.assertEqual(msgs, expected) finally: conf.supybot.nick.setValue(originalNick) conf.supybot.user.setValue(originalUser) conf.supybot.networks.test.password.setValue(originalPassword)
def testFirstCommands(self): try: originalNick = conf.supybot.nick() originalUser = conf.supybot.user() originalPassword = conf.supybot.networks.test.password() nick = 'nick' conf.supybot.nick.setValue(nick) user = '******' conf.supybot.user.setValue(user) expected = [ircmsgs.nick(nick), ircmsgs.user('supybot', user)] irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: msgs.append(irc.takeMsg()) msgs.pop() self.assertEqual(msgs, expected) password = '******' conf.supybot.networks.test.password.setValue(password) irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: msgs.append(irc.takeMsg()) msgs.pop() expected.insert(0, ircmsgs.password(password)) self.assertEqual(msgs, expected) finally: conf.supybot.nick.setValue(originalNick) conf.supybot.user.setValue(originalUser) conf.supybot.networks.test.password.setValue(originalPassword)
def testFirstCommands(self): try: originalNick = conf.supybot.nick() originalUser = conf.supybot.user() originalPassword = conf.supybot.networks.test.password() nick = 'nick' conf.supybot.nick.setValue(nick) user = '******' conf.supybot.user.setValue(user) expected = [ ircmsgs.nick(nick), ircmsgs.user('limnoria', user), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'metadata-notify')), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-tag')), ircmsgs.IrcMsg(command='CAP', args=('END',)), ] irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: msgs.append(irc.takeMsg()) msgs.pop() self.assertEqual(msgs, expected) password = '******' conf.supybot.networks.test.password.setValue(password) irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: msgs.append(irc.takeMsg()) msgs.pop() expected.insert(0, ircmsgs.password(password)) self.assertEqual(msgs, expected) finally: conf.supybot.nick.setValue(originalNick) conf.supybot.user.setValue(originalUser) conf.supybot.networks.test.password.setValue(originalPassword)
def testFirstCommands(self): try: originalNick = conf.supybot.nick() originalUser = conf.supybot.user() originalPassword = conf.supybot.networks.test.password() nick = 'nick' conf.supybot.nick.setValue(nick) user = '******' conf.supybot.user.setValue(user) expected = [ ircmsgs.nick(nick), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')), ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')), ircmsgs.IrcMsg(command='CAP', args=('END', )), ircmsgs.user('limnoria', user) ] irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: msgs.append(irc.takeMsg()) msgs.pop() self.assertEqual(msgs, expected) password = '******' conf.supybot.networks.test.password.setValue(password) irc = irclib.Irc('test') msgs = [irc.takeMsg()] while msgs[-1] != None: msgs.append(irc.takeMsg()) msgs.pop() expected.insert(0, ircmsgs.password(password)) self.assertEqual(msgs, expected) finally: conf.supybot.nick.setValue(originalNick) conf.supybot.user.setValue(originalUser) conf.supybot.networks.test.password.setValue(originalPassword)