Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 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)
Example #9
0
 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)
Example #10
0
 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)