Skip to content
Browse files

Amended the inactive redirect tests

  • Loading branch information...
1 parent 7dd8bc8 commit c37e4c9d9d2863dfc4d7ac363b93bb28f9c1ee1a @flashingpumpkin committed
Showing with 18 additions and 2 deletions.
  1. +17 −1 socialregistration/tests.py
  2. +1 −1 socialregistration/views.py
View
18 socialregistration/tests.py
@@ -197,7 +197,8 @@ def handler(sender, **kwargs):
self.assertEqual(1, counter.counter)
- def test_setup_callback_should_indicate_a_logged_in_inactive_user(self):
+
+ def test_setup_callback_should_indicate_an_inactive_user(self):
user = self.create_user(is_active=False)
self.create_profile(user)
@@ -208,6 +209,21 @@ def test_setup_callback_should_indicate_a_logged_in_inactive_user(self):
self.assertEqual(200, response.status_code, response.content)
self.assertContains(response, "inactive", 1)
+ def test_setup_callback_should_redirect_an_inactive_user(self):
+ settings.LOGIN_INACTIVE_REDIRECT_URL = '/inactive/'
+
+ user = self.create_user(is_active=False)
+ self.create_profile(user)
+
+ self.redirect()
+ self.callback()
+ response = self.setup_callback()
+
+ self.assertEqual(302, response.status_code, response.content)
+ self.assertTrue('/inactive/' in response['Location'])
+
+ settings.LOGIN_INACTIVE_REDIRECT_URL = False
+
class OAuth2Test(OAuthTest):
def redirect(self):
View
2 socialregistration/views.py
@@ -271,7 +271,7 @@ def get(self, request):
return HttpResponseRedirect(reverse('socialregistration:setup'))
- # Inactive user - displaying an error message.
+ # Inactive user - displaying / redirect to the appropriate place.
if not user.is_active:
return self.inactive_response()

0 comments on commit c37e4c9

Please sign in to comment.
Something went wrong with that request. Please try again.