示例#1
0
 def test_reset_password(self):
     with capture_reset_password_requests() as requests:
         self._post('/reset', data=dict(email='*****@*****.**'),
                    follow_redirects=True)
         token = requests[0]['token']
     r = self._get('/reset/' + token)
     self.assertIn("My Reset Password Submit Field", r.data)
 def test_reset_password(self):
     with capture_reset_password_requests() as requests:
         self._post('/reset', data=dict(email='*****@*****.**'),
                    follow_redirects=True)
         token = requests[0]['token']
     r = self._get('/reset/' + token)
     self.assertIn("My Reset Password Submit Field", r.data)
 def test_reset_view(self):
     with capture_reset_password_requests() as requests:
         r = self._post('/reset', data=dict(email='*****@*****.**'),
                        follow_redirects=True)
         t = requests[0]['token']
     r = self._get('/reset/' + t)
     self.assertIn('<h1>Reset password</h1>', r.data)
 def test_reset_view(self):
     with capture_reset_password_requests() as requests:
         r = self._post('/reset',
                        data=dict(email='*****@*****.**'),
                        follow_redirects=True)
         t = requests[0]['token']
     r = self._get('/reset/' + t)
     self.assertIn('<h1>Reset password</h1>', r.data)
    def test_reset_password_template(self):
        with capture_reset_password_requests() as requests:
            r = self._post('/reset', data=dict(email='*****@*****.**'),
                           follow_redirects=True)

            t = requests[0]['token']

        r = self._get('/reset/' + t)

        self.assertIn('CUSTOM RESET PASSWORD', r.data)
示例#6
0
    def test_reset_password_with_valid_token(self):
        with capture_reset_password_requests() as requests:
            r = self.client.post("/reset", data=dict(email="*****@*****.**"), follow_redirects=True)
            t = requests[0]["token"]

        r = self._post(
            "/reset/" + t, data={"password": "******", "password_confirm": "newpassword"}, follow_redirects=True
        )

        r = self.authenticate("*****@*****.**", "newpassword")
        self.assertIn("Hello [email protected]", r.data)
    def test_reset_password_template(self):
        with capture_reset_password_requests() as requests:
            r = self._post('/reset',
                           data=dict(email='*****@*****.**'),
                           follow_redirects=True)

            t = requests[0]['token']

        r = self._get('/reset/' + t)

        self.assertIn('CUSTOM RESET PASSWORD', r.data)
示例#8
0
    def test_reset_password_with_expired_token(self):
        with capture_reset_password_requests() as requests:
            r = self.client.post("/reset", data=dict(email="*****@*****.**"), follow_redirects=True)
            t = requests[0]["token"]

        time.sleep(2)

        r = self.client.post(
            "/reset/" + t, data={"password": "******", "password_confirm": "newpassword"}, follow_redirects=True
        )

        self.assertIn("You did not reset your password within", r.data)
    def test_reset_password_with_expired_token(self):
        with capture_reset_password_requests() as requests:
            r = self._post('/reset', data=dict(email='*****@*****.**'),
                           follow_redirects=True)
            t = requests[0]['token']

        time.sleep(1)

        r = self._post('/reset/' + t, data={
            'password': '******',
            'password_confirm': 'newpassword'
        }, follow_redirects=True)

        self.assertIn('You did not reset your password within', r.data)
    def test_reset_password_with_valid_token(self):
        with capture_reset_password_requests() as requests:
            r = self._post('/reset', data=dict(email='*****@*****.**'),
                           follow_redirects=True)
            t = requests[0]['token']

        r = self._post('/reset/' + t, data={
            'password': '******',
            'password_confirm': 'newpassword'
        }, follow_redirects=True)

        r = self.logout()
        r = self.authenticate('*****@*****.**', 'newpassword')
        self.assertIn('Hello [email protected]', r.data)
示例#11
0
    def test_reset_password_with_expired_token(self):
        with capture_reset_password_requests() as requests:
            r = self._post('/reset', data=dict(email='*****@*****.**'),
                           follow_redirects=True)
            t = requests[0]['token']

        time.sleep(1)

        r = self._post('/reset/' + t, data={
            'password': '******',
            'password_confirm': 'newpassword'
        }, follow_redirects=True)

        self.assertIn('You did not reset your password within', r.data)
示例#12
0
    def test_reset_password_with_valid_token(self):
        with capture_reset_password_requests() as requests:
            r = self._post('/reset',
                                 data=dict(email='*****@*****.**'),
                                 follow_redirects=True)
            t = requests[0]['token']

        r = self._post('/reset/' + t, data={
            'password': '******',
            'password_confirm': 'newpassword'
        }, follow_redirects=True)

        r = self.logout()
        r = self.authenticate('*****@*****.**', 'newpassword')
        self.assertIn('Hello [email protected]', r.data)
 def test_forgot_post_sends_email(self):
     with capture_reset_password_requests():
         with self.app.extensions['mail'].record_messages() as outbox:
             self._post('/reset', data=dict(email='*****@*****.**'))
             self.assertEqual(len(outbox), 1)
示例#14
0
 def test_forgot_post_sends_email(self):
     with capture_reset_password_requests():
         with self.app.extensions["mail"].record_messages() as outbox:
             self.client.post("/reset", data=dict(email="*****@*****.**"))
             self.assertEqual(len(outbox), 1)
示例#15
0
 def test_forgot_post_sends_email(self):
     with capture_reset_password_requests():
         with self.app.extensions['mail'].record_messages() as outbox:
             self._post('/reset', data=dict(email='*****@*****.**'))
             self.assertEqual(len(outbox), 1)