@@ -38,7 +38,7 @@ def test_valid_login(self, mock_signal):
3838 response = self .
_post ({
'auth-username' :
'[email protected] ' ,
3939 'auth-password' : 'secret' ,
4040 'login_view-current_step' : 'auth' })
41- self .assertRedirects (response , reverse ( 'two_factor:setup' ))
41+ self .assertRedirects (response , resolve_url ( settings . LOGIN_REDIRECT_URL ))
4242
4343 # No signal should be fired for non-verified user logins.
4444 self .assertFalse (mock_signal .called )
@@ -80,8 +80,7 @@ def test_valid_login_with_allowed_external_redirect(self):
8080 {
'auth-username' :
'[email protected] ' ,
8181 'auth-password' : 'secret' ,
8282 'login_view-current_step' : 'auth' })
83- self .assertEqual (self .client .session .get ('next' ), redirect_url )
84- self .assertRedirects (response , reverse ('two_factor:setup' ), fetch_redirect_response = False )
83+ self .assertRedirects (response , redirect_url , fetch_redirect_response = False )
8584
8685 def test_valid_login_with_disallowed_external_redirect (self ):
8786 redirect_url = 'https://test.disallowed-success-url.com'
@@ -91,7 +90,7 @@ def test_valid_login_with_disallowed_external_redirect(self):
9190 {
'auth-username' :
'[email protected] ' ,
9291 'auth-password' : 'secret' ,
9392 'login_view-current_step' : 'auth' })
94- self .assertRedirects (response , reverse ('two_factor:setup ' ), fetch_redirect_response = False )
93+ self .assertRedirects (response , reverse ('two_factor:profile ' ), fetch_redirect_response = False )
9594
9695 @mock .patch ('two_factor.views.core.time' )
9796 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):
396395 response = self .
_post ({
'auth-username' :
'[email protected] ' ,
397396 'auth-password' : 'secret' ,
398397 'login_view-current_step' : 'auth' })
399- self .assertRedirects (response , reverse ( 'two_factor:setup' ))
398+ self .assertRedirects (response , resolve_url ( settings . LOGIN_REDIRECT_URL ))
400399
401400 response = self .
_post ({
'auth-username' :
'[email protected] ' ,
402401 'auth-password' : 'secret' ,
403402 'login_view-current_step' : 'auth' })
404- self .assertRedirects (response , reverse ( 'two_factor:setup' ))
403+ self .assertRedirects (response , resolve_url ( settings . LOGIN_REDIRECT_URL ))
405404
406405 def test_missing_management_data (self ):
407406 # missing management data
@@ -432,7 +431,7 @@ def test_login_different_user_with_otp_on_existing_session(self):
432431 response = self .
_post ({
'auth-username' :
'[email protected] ' ,
433432 'auth-password' : 'secret' ,
434433 'login_view-current_step' : 'auth' })
435- self .assertRedirects (response , reverse ( 'two_factor:setup' ))
434+ self .assertRedirects (response , resolve_url ( settings . LOGIN_REDIRECT_URL ))
436435
437436 response = self .
_post ({
'auth-username' :
'[email protected] ' ,
438437 'auth-password' : 'secret' ,
0 commit comments