def testAttributeProtectedPage(self): xmlconfig( StringIO(template % u''' <browser:page name="test" class="zope.browserpage.tests.test_page.V2" for="zope.browserpage.tests.test_page.IC" attribute="action" permission="zope.Public" allowed_attributes="action2" /> ''')) v = component.getMultiAdapter((ob, self.request), name='test') v = ProxyFactory(v) self.assertEqual(v.action(), 'done') self.assertEqual(v.action2(), 'done') self.assertRaises(Exception, getattr, v, 'index')
def testAttributeProtectedPage(self): xmlconfig(StringIO(template % ''' <browser:page name="test" class="zope.app.publisher.browser.tests.test_directives.V2" for="zope.app.component.tests.views.IC" attribute="action" permission="zope.Public" allowed_attributes="action2" /> ''' )) v = zapi.getMultiAdapter((ob, request), name='test') v = ProxyFactory(v) self.assertEqual(v.action(), 'done') self.assertEqual(v.action2(), 'done') self.assertRaises(Exception, getattr, v, 'index')
def testAttributeProtectedView(self): xmlconfig( StringIO(template % u''' <browser:view name="test" class="zope.browserpage.tests.test_page.V2" for="zope.browserpage.tests.test_page.IC" permission="zope.Public" allowed_attributes="action2" > <browser:page name="index.html" attribute="action" /> </browser:view> ''')) v = component.getMultiAdapter((ob, self.request), name='test') v = ProxyFactory(v) page = v.publishTraverse(self.request, 'index.html') self.assertEqual(page(), 'done') self.assertEqual(v.action2(), 'done') self.assertRaises(Exception, getattr, page, 'index')
def testAttributeProtectedView(self): xmlconfig(StringIO(template % ''' <browser:view name="test" class="zope.browserpage.tests.test_page.V2" for="zope.component.testfiles.views.IC" permission="zope.Public" allowed_attributes="action2" > <browser:page name="index.html" attribute="action" /> </browser:view> ''' )) v = component.getMultiAdapter((ob, request), name='test') v = ProxyFactory(v) page = v.publishTraverse(request, 'index.html') self.assertEqual(page(), 'done') self.assertEqual(v.action2(), 'done') self.assertRaises(Exception, getattr, page, 'index')