Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)