Permalink
Browse files

Unit test for inactive users

  • Loading branch information...
1 parent ae8d743 commit f42f8667fa1a0de4daeefe798fabb1cc3927af3e @lizrice lizrice committed May 22, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 socialregistration/tests.py
@@ -82,9 +82,10 @@ def get_setup_callback_mock_response(self, *args, **kwargs):
def create_profile(self):
raise NotImplementedError
- def create_user(self):
+ def create_user(self, is_active=True):
user = User.objects.create(username='alen')
user.set_password('test')
+ user.is_active = is_active
user.save()
return user
@@ -196,6 +197,16 @@ def handler(sender, **kwargs):
self.assertEqual(1, counter.counter)
+ def test_setup_callback_should_indicate_a_logged_in_inactive_user(self):
+ user = self.create_user(is_active=False)
+ self.create_profile(user)
+
+ self.redirect()
+ self.callback()
+ response = self.setup_callback()
+
+ self.assertEqual(200, response.status_code, response.content)
+ self.assertContains(response, "inactive", 1)
class OAuth2Test(OAuthTest):

0 comments on commit f42f866

Please sign in to comment.