Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Change VALIDATED to VERIFIED.
  • Loading branch information
Minglee01 committed Jun 5, 2017
1 parent 89e4992 commit 6b69cd7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions user_management/ui/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,26 @@ def test_get_registered_user(self):

query_string = 'validated'

@override_settings(VALIDATED_QUERYSTRING=query_string)
def test_get_redirect_url_with_query(self):
@override_settings(VERIFIED_QUERYSTRING=query_string)
def test_get_redirect_url_with_query_string(self):
view = views.VerifyUserEmailView
self.already_verified = False
response = view.get_redirect_url(self)
view.already_verified = False
response = view.get_redirect_url(view)
expected_url = '/accounts/login/?' + self.query_string

self.assertEqual(response, expected_url)

def test_get_redirect_url_without_query(self):
@override_settings(VERIFIED_QUERYSTRING=query_string)
def test_get_redirect_url_with_verified_user(self):
view = views.VerifyUserEmailView
self.already_verified = False
response = view.get_redirect_url(self)
view.already_verified = True
response = view.get_redirect_url(view)

self.assertEqual(response, '/accounts/login/')

def test_get_redirect_url_without_query_setting(self):
view = views.VerifyUserEmailView
view.already_verified = False
response = view.get_redirect_url(view)

self.assertEqual(response, '/accounts/login/')
2 changes: 1 addition & 1 deletion user_management/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class VerifyUserEmailView(VerifyAccountViewMixin, generic.RedirectView):
permission_denied_class = AlreadyVerifiedException

def get_redirect_url(self, *args, **kwargs):
query_string = getattr(settings, 'VALIDATED_QUERYSTRING', '')
query_string = getattr(settings, 'VERIFIED_QUERYSTRING', '')
url_extra = ''

if query_string and not self.already_verified:
Expand Down

0 comments on commit 6b69cd7

Please sign in to comment.