Exemple #1
0
 def test_forbid_logged_in(self):
     """When logged in, forbid() returns 403"""
     with patch.object(DummyRequest,
                       "authenticated_userid",
                       new_callable=PropertyMock) as auid:
         auid.return_value = "abc"
         ret = auth._forbid(self.request)
         self.assertEqual(ret.status_code, 403)
Exemple #2
0
 def test_forbid_logged_in(self):
     """ When logged in, forbid() returns 403 """
     self.request.userid = 'abc'
     ret = auth._forbid(self.request)
     self.assertEqual(ret.status_code, 403)
Exemple #3
0
 def test_forbid(self):
     """ When not logged in, forbid() returns 401 """
     ret = auth._forbid(self.request)
     self.assertEqual(ret.status_code, 401)
Exemple #4
0
 def test_forbid_logged_in(self):
     """ When logged in, forbid() returns 403 """
     self.request.userid = "abc"
     ret = auth._forbid(self.request)
     self.assertEqual(ret.status_code, 403)
Exemple #5
0
 def test_forbid(self):
     """ When not logged in, forbid() returns 401 """
     ret = auth._forbid(self.request)
     self.assertEqual(ret.status_code, 401)