Exemple #1
0
    def testRegisterVerify(self):
        m = self.getMsg("register p4ssw0rd")
        label = m.server_tags.pop("label")
        self.assertEqual(
            m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))
        self.irc.feedMsg(
            IrcMsg(server_tags={"label": label},
                   command="REGISTER",
                   args=[
                       "VERIFICATION_REQUIRED", "accountname",
                       "check your emails"
                   ]))
        self.assertResponse(
            "", "Registration of accountname on test requires verification "
            "to complete: check your emails")

        m = self.getMsg("verify accountname c0de")
        label = m.server_tags.pop("label")
        self.assertEqual(
            m, IrcMsg(command="VERIFY", args=["accountname", "c0de"]))
        self.irc.feedMsg(
            IrcMsg(server_tags={"label": label},
                   command="VERIFY",
                   args=["SUCCESS", "accountname", "welcome!"]))
        self.assertResponse(
            "",
            "Verification of account accountname on test succeeded: welcome!")
Exemple #2
0
    def testRegisterSuccessBatch(self):
        # oragono replies with a batch
        m = self.getMsg("register p4ssw0rd")
        label = m.server_tags.pop("label")
        self.assertEqual(
            m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))

        batch_name = "Services_testRegisterSuccessBatch"
        self.irc.feedMsg(
            IrcMsg(server_tags={"label": label},
                   command="BATCH",
                   args=["+" + batch_name, "labeled-response"]))
        self.irc.feedMsg(
            IrcMsg(server_tags={"batch": batch_name},
                   command="REGISTER",
                   args=["SUCCESS", "accountname", "welcome!"]))
        self.irc.feedMsg(
            IrcMsg(
                server_tags={"batch": batch_name},
                command="NOTICE",
                args=[self.irc.nick, "Registration succeeded blah blah blah"]))
        self.irc.feedMsg(IrcMsg(
            command="BATCH",
            args=["-" + batch_name],
        ))

        self.assertResponse(
            "",
            "Registration of account accountname on test succeeded: welcome!")
Exemple #3
0
 def testRegisterSuccess(self):
     m = self.getMsg("register p4ssw0rd")
     label = m.server_tags.pop("label")
     self.assertEqual(m, IrcMsg(command="REGISTER", args=["*", "p4ssw0rd"]))
     self.irc.feedMsg(
         IrcMsg(server_tags={"label": label},
                command="REGISTER",
                args=["SUCCESS", "accountname", "welcome!"]))
     self.assertResponse(
         "",
         "Registration of account accountname on test succeeded: welcome!")
Exemple #4
0
    def testRegisterNoExperimentalExtensions(self):
        self.assertRegexp("register p4ssw0rd",
                          "error: Experimental IRC extensions")

        self.irc.feedMsg(
            IrcMsg(command="FAIL", args=["REGISTER", "BLAH", "message"]))
        self.assertIsNone(self.irc.takeMsg())

        self.irc.feedMsg(
            IrcMsg(command="REGISTER", args=["SUCCESS", "account", "msg"]))
        self.assertIsNone(self.irc.takeMsg())

        self.irc.feedMsg(
            IrcMsg(command="REGISTER",
                   args=["VERIFICATION_REQUIRED", "account", "msg"]))
        self.assertIsNone(self.irc.takeMsg())
Exemple #5
0
    def _meetbot_call(self, irc, msg, new_command, args=None):
        # new_command is a meetbot command string, e.g. "#action user needs to do foo"
        # if args is passed, it needs to be a list.
        # args items will get stringified and concatenated to the new command
        if args:
            # "#command arg arg arg"
            new_command += ' ' + ' '.join(map(str, args))
        meet_bot = irc.getCallback('MeetBot')
        new_msg = IrcMsg(prefix='', args=(msg.args[0], new_command), msg=msg)
        meet_bot.doPrivmsg(irc, new_msg)

        # anyone participating in triage implicitly joins
        if msg.nick not in self.triagers:
            self.here(irc, msg, [])
Exemple #6
0
    def testRegisterVerifyBatch(self):
        m = self.getMsg("register p4ssw0rd")
        label = m.server_tags.pop("label")
        self.assertEqual(
            m, IrcMsg(command="REGISTER", args=["*", "*", "p4ssw0rd"]))
        self.irc.feedMsg(
            IrcMsg(server_tags={"label": label},
                   command="REGISTER",
                   args=[
                       "VERIFICATION_REQUIRED", "accountname",
                       "check your emails"
                   ]))
        self.assertResponse(
            "", "Registration of accountname on test requires verification "
            "to complete: check your emails")

        m = self.getMsg("verify accountname c0de")
        label = m.server_tags.pop("label")
        self.assertEqual(
            m, IrcMsg(command="VERIFY", args=["accountname", "c0de"]))

        batch_name = "Services_testVerifySuccessBatch"
        self.irc.feedMsg(
            IrcMsg(server_tags={"label": label},
                   command="BATCH",
                   args=["+" + batch_name, "labeled-response"]))
        self.irc.feedMsg(
            IrcMsg(server_tags={"batch": batch_name},
                   command="VERIFY",
                   args=["SUCCESS", "accountname", "welcome!"]))
        self.irc.feedMsg(
            IrcMsg(
                server_tags={"batch": batch_name},
                command="NOTICE",
                args=[self.irc.nick, "Verification succeeded blah blah blah"]))
        self.irc.feedMsg(IrcMsg(
            command="BATCH",
            args=["-" + batch_name],
        ))

        self.assertResponse(
            "",
            "Verification of account accountname on test succeeded: welcome!")
Exemple #7
0
 def _identify(self, irc):
     irc.feedMsg(IrcMsg(command='376', args=(self.nick, )))
     msg = irc.takeMsg()
     self.assertEqual(msg.command, 'PRIVMSG')
     self.assertEqual(msg.args[0], 'NickServ')
     irc.feedMsg(ircmsgs.notice(self.nick, 'now identified', 'NickServ'))