forked from jazzband/django-two-factor-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d1ecfe
commit 6ed5a45
Showing
3 changed files
with
19 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ def test_valid_login(self, mock_signal): | |
response = self._post({'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
'login_view-current_step': 'auth'}) | ||
self.assertRedirects(response, reverse('two_factor:setup')) | ||
self.assertRedirects(response, resolve_url(settings.LOGIN_REDIRECT_URL)) | ||
|
||
# No signal should be fired for non-verified user logins. | ||
self.assertFalse(mock_signal.called) | ||
|
@@ -80,8 +80,7 @@ def test_valid_login_with_allowed_external_redirect(self): | |
{'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
'login_view-current_step': 'auth'}) | ||
self.assertEqual(self.client.session.get('next'), redirect_url) | ||
self.assertRedirects(response, reverse('two_factor:setup'), fetch_redirect_response=False) | ||
self.assertRedirects(response, redirect_url, fetch_redirect_response=False) | ||
|
||
def test_valid_login_with_disallowed_external_redirect(self): | ||
redirect_url = 'https://test.disallowed-success-url.com' | ||
|
@@ -91,7 +90,7 @@ def test_valid_login_with_disallowed_external_redirect(self): | |
{'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
'login_view-current_step': 'auth'}) | ||
self.assertRedirects(response, reverse('two_factor:setup'), fetch_redirect_response=False) | ||
self.assertRedirects(response, reverse('two_factor:profile'), fetch_redirect_response=False) | ||
|
||
@mock.patch('two_factor.views.core.time') | ||
def test_valid_login_primary_key_stored(self, mock_time): | ||
|
@@ -396,12 +395,12 @@ def test_login_different_user_on_existing_session(self, mock_logger): | |
response = self._post({'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
'login_view-current_step': 'auth'}) | ||
self.assertRedirects(response, reverse('two_factor:setup')) | ||
self.assertRedirects(response, resolve_url(settings.LOGIN_REDIRECT_URL)) | ||
|
||
response = self._post({'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
'login_view-current_step': 'auth'}) | ||
self.assertRedirects(response, reverse('two_factor:setup')) | ||
self.assertRedirects(response, resolve_url(settings.LOGIN_REDIRECT_URL)) | ||
|
||
def test_missing_management_data(self): | ||
# missing management data | ||
|
@@ -432,7 +431,7 @@ def test_login_different_user_with_otp_on_existing_session(self): | |
response = self._post({'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
'login_view-current_step': 'auth'}) | ||
self.assertRedirects(response, reverse('two_factor:setup')) | ||
self.assertRedirects(response, resolve_url(settings.LOGIN_REDIRECT_URL)) | ||
|
||
response = self._post({'auth-username': '[email protected]', | ||
'auth-password': 'secret', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters