def test_logged_in_inactive(self): """Inactive user is denied access.""" request = self.rf.get('/foo') user = self.user_model.objects.get(username='******') user.is_active = False request.user = user view = permission_required('perm')(simple_view) response = view(request) eq_(403, response.status_code)
def test_logged_in_inactive(self): """Inactive user is denied access.""" request = self.rf.get('/foo') user = User.objects.get(username='******') user.is_active = False request.user = user view = permission_required('perm')(simple_view) response = view(request) eq_(403, response.status_code)
def test_logged_in_inactive(self): """Inactive user is denied access.""" request = self.rf.get("/foo") user = self.user_model.objects.get(username="******") user.is_active = False request.user = user view = permission_required("perm")(simple_view) response = view(request) eq_(403, response.status_code)
def test_logged_in_default(self): request = self.rf.get('/foo') request.user = self.user_model.objects.get(username='******') view = permission_required('perm')(simple_view) response = view(request) eq_(403, response.status_code)
def test_logged_out_default(self): request = self.rf.get('/foo') request.user = AnonymousUser() view = permission_required('perm')(simple_view) response = view(request) eq_(302, response.status_code)
def test_logged_in_default(self): request = self.rf.get("/foo") request.user = self.user_model.objects.get(username="******") view = permission_required("perm")(simple_view) response = view(request) eq_(403, response.status_code)
def test_logged_out_default(self): request = self.rf.get("/foo") request.user = AnonymousUser() view = permission_required("perm")(simple_view) response = view(request) eq_(302, response.status_code)
def test_logged_in_admin(self): request = self.rf.get('/foo') request.user = self.user_model.objects.get(username='******') view = permission_required('perm')(simple_view) response = view(request) eq_(200, response.status_code)
def test_logged_in_admin(self): request = self.rf.get('/foo') request.user = User.objects.get(username='******') view = permission_required('perm')(simple_view) response = view(request) eq_(200, response.status_code)
def test_logged_in_default(self): request = self.rf.get('/foo') request.user = User.objects.get(username='******') view = permission_required('perm')(simple_view) response = view(request) eq_(403, response.status_code)