Skip to content

Commit

Permalink
add a test to make sure reset password form are displayed correctly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish authored and arikfr committed Apr 14, 2019
1 parent 1f43537 commit b96094b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redash/handlers/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -77,7 +77,7 @@ def render_token_login_page(template, org_slug, token, invite=True):

@routes.route(org_scoped_rule('/invite/<token>'), 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/<token>'), methods=['GET', 'POST'])
Expand Down
7 changes: 7 additions & 0 deletions tests/handlers/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down

0 comments on commit b96094b

Please sign in to comment.