def test_rest_content(self): from ptah.cms.rest import cmsContent self._init_ptah() request = self._makeRequest() self.assertRaises(ptah.cms.NotFound, cmsContent, request, 'root') factory = ptah.cms.ApplicationFactory('/test', 'root', 'Root App') root = factory(request) root.__uri__ = 'cms+app:test' transaction.commit() self._allow = False self.assertRaises(ptah.cms.Forbidden, cmsContent, request, 'test') self._allow = True root = factory(request) info = cmsContent(request, 'test') self.assertEqual(info['__uri__'], root.__uri__) self.assertRaises(ptah.cms.NotFound, cmsContent, request, 'test', action='unknown') info = cmsContent(request, 'test', root.__uri__) self.assertEqual(info['__uri__'], root.__uri__)
def test_rest_content_default(self): from ptah.cms.rest import cmsContent ApplicationRoot = self._make_app() self.init_ptah() request = DummyRequest(subpath=('content',), environ=self._environ) factory = ptah.cms.ApplicationFactory( ApplicationRoot, '/', 'root', 'Root App', config=self.config) root = factory(request) root.__uri__ = 'cms-app:test' transaction.commit() self._allow = False self.assertRaises(ptah.cms.Forbidden, cmsContent, request) self._allow = True root = factory(request) info = cmsContent(request) self.assertEqual(info['__uri__'], root.__uri__) self.assertRaises(ptah.cms.NotFound, cmsContent, request, action='unknown') info = cmsContent(request, root.__uri__) self.assertEqual(info['__uri__'], root.__uri__)
def test_rest_content_default(self): from ptah.cms.rest import cmsContent ApplicationRoot = self._make_app() self.init_ptah() request = DummyRequest(subpath=('content', ), environ=self._environ) factory = ptah.cms.ApplicationFactory(ApplicationRoot, '/', 'root', 'Root App', config=self.config) root = factory(request) root.__uri__ = 'cms-app:test' transaction.commit() self._allow = False self.assertRaises(ptah.cms.Forbidden, cmsContent, request) self._allow = True root = factory(request) info = cmsContent(request) self.assertEqual(info['__uri__'], root.__uri__) self.assertRaises(ptah.cms.NotFound, cmsContent, request, action='unknown') info = cmsContent(request, root.__uri__) self.assertEqual(info['__uri__'], root.__uri__)