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