jasminefiner
9/22/2018 - 1:38 PM

16: Test Confirmation Route

UMS: User Registration 16

# tests/test_auth.py
# ...
class AuthenticationTestCase(unittest.TestCase):
    # ...
    def test_confirmation_route(self):
            self.register('john@example.com',
                          'john',
                          'cat',
                          'cat')
            u = User.query.filter_by(email='john@example.com').first()
            token = u.generate_confirmation_token()
            response = self.client.get('/auth/confirm/token', follow_redirects=True)
            self.assertIn('Please log in to access this page.', response.get_data(as_text=True))
            self.assertEqual(response.status_code, 200)