From b96094b878585421b5d8d598578c046b5d62af30 Mon Sep 17 00:00:00 2001 From: Omer Lachish Date: Sun, 14 Apr 2019 14:59:21 +0300 Subject: [PATCH] add a test to make sure reset password form are displayed correctly (#3678) --- redash/handlers/authentication.py | 4 ++-- tests/handlers/test_authentication.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/redash/handlers/authentication.py b/redash/handlers/authentication.py index 9b1cd883af..cec7f67fdc 100644 --- a/redash/handlers/authentication.py +++ b/redash/handlers/authentication.py @@ -25,7 +25,7 @@ def get_google_auth_url(next_path): return google_auth_url -def render_token_login_page(template, org_slug, token, invite=True): +def render_token_login_page(template, org_slug, token, invite): try: user_id = validate_token(token) org = current_org._get_current_object() @@ -77,7 +77,7 @@ def render_token_login_page(template, org_slug, token, invite=True): @routes.route(org_scoped_rule('/invite/'), methods=['GET', 'POST']) def invite(token, org_slug=None): - return render_token_login_page("invite.html", org_slug, token) + return render_token_login_page("invite.html", org_slug, token, True) @routes.route(org_scoped_rule('/reset/'), methods=['GET', 'POST']) diff --git a/tests/handlers/test_authentication.py b/tests/handlers/test_authentication.py index 1559921d14..a4cd43463a 100644 --- a/tests/handlers/test_authentication.py +++ b/tests/handlers/test_authentication.py @@ -8,6 +8,13 @@ from redash.models import User +class TestResetPassword(BaseTestCase): + def test_shows_reset_password_form(self): + user = self.factory.create_user(is_invitation_pending=False) + token = invite_token(user) + response = self.get_request('/reset/{}'.format(token), org=self.factory.org) + self.assertEqual(response.status_code, 200) + class TestInvite(BaseTestCase): def test_expired_invite_token(self):