示例#1
0
    def test_resetpassword_required(self):
        from ptah.crowd.resetpassword import ResetPassword

        request = DummyRequest(POST={"form.buttons.reset": "Reset"})

        form = ResetPassword(None, request)
        form.update()

        msg = request.session["msgservice"][0]
        self.assertIn("System can't restore password for this user.", msg)
示例#2
0
    def test_resetpassword_cancel(self):
        from ptah.crowd.resetpassword import ResetPassword

        request = DummyRequest(POST={"form.buttons.cancel": "Cancel"})

        form = ResetPassword(None, request)
        try:
            form.update()
        except Exception, res:
            pass
示例#3
0
    def test_resetpassword(self):
        from ptah.crowd.provider import CrowdUser, Session
        from ptah.crowd.resetpassword import ResetPassword
        from ptah.crowd.resetpassword import ResetPasswordTemplate

        user = CrowdUser("name", "login", "email")
        Session.add(user)
        Session.flush()

        data = [1, None]

        def send(self):
            data[0] = 2
            data[1] = self.passcode

        ResetPasswordTemplate.send = send

        request = DummyRequest(POST={"login": "******", "form.buttons.reset": "Reset"})

        form = ResetPassword(None, request)
        try:
            form.update()
        except HTTPFound, res:
            pass