Example #1
0
 def test_that_login_view_get_with_logged_in_user_returns_200(self):
     request = self.factory.get('/')
     request.session = self.session
     request.session['user'] = self.user
     request.user = self.user
     response = login_view(request)
     self.assertEquals(response.status_code, 200)
Example #2
0
 def test_that_login_view_post_with_correct_credentials_but_inactive_user_returns_200(self):
     # This is an unimplemented feature - emails validating users as is_active
     # Currently all users are active by default, but the logic still exists for
     # non active users in the login view
     request = self.factory.post('/', {'username':'chris', 'password':'bagel'})
     self.user.is_active = False
     self.user.save()
     request.session = self.session
     request.user = self.user
     response = login_view(request)
     self.assertEquals(response.status_code, 200)
Example #3
0
 def test_that_login_view_post_with_invalid_user_credentials_returns_200(self):
     request = self.factory.post('/', {'username':'bad_username', 'password':'bad_password'})
     request.session = self.session
     response = login_view(request)
     self.assertEquals(response.status_code, 200)
Example #4
0
 def test_that_login_view_post_with_correct_credentials_returns_200(self):
     request = self.factory.post('/', {'username':'chris', 'password':'bagel'})
     request.session = self.session
     request.user = self.user
     response = login_view(request)
     self.assertEquals(response.status_code, 200)