Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
 def test_forbid(self):
     """ When not logged in, forbid() returns 401 """
     ret = auth._forbid(self.request)
     self.assertEqual(ret.status_code, 401)
Exemplo n.º 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)
Exemplo n.º 5
0
 def test_forbid(self):
     """ When not logged in, forbid() returns 401 """
     ret = auth._forbid(self.request)
     self.assertEqual(ret.status_code, 401)