Exemple #1
0
    def testInterfaceProtectedPage(self):
        xmlconfig(
            StringIO(template % u'''
            <browser:page name="test"
                class="zope.browserpage.tests.test_page.V1"
                attribute="index"
                for="zope.browserpage.tests.test_page.IC"
                permission="zope.Public"
                allowed_interface="zope.browserpage.tests.test_page.IV"
                />
            '''))

        v = component.getMultiAdapter((ob, self.request), name='test')
        v = ProxyFactory(v)
        self.assertEqual(v.index(), 'V1 here')
        self.assertRaises(Exception, getattr, v, 'action')
Exemple #2
0
    def testInterfaceProtectedPage(self):
        xmlconfig(StringIO(template %
            '''
            <browser:page name="test"
                class="zope.app.component.tests.views.V1"
                attribute="index"
                for="zope.app.component.tests.views.IC"
                permission="zope.Public"
                allowed_interface="zope.app.component.tests.views.IV"
                />
            '''
            ))

        v = zapi.getMultiAdapter((ob, request), name='test')
        v = ProxyFactory(v)
        self.assertEqual(v.index(), 'V1 here')
        self.assertRaises(Exception, getattr, v, 'action')
Exemple #3
0
 def testInterfaceProtectedView(self):
     xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
     v = component.getMultiAdapter((ob, request), name='test2')
     v = ProxyFactory(v)
     self.assertEqual(v.index(), 'V1 here')
     self.assertRaises(Exception, getattr, v, 'action')
Exemple #4
0
 def testInterfaceProtectedView(self):
     xmlconfig.file("xmlrpc.zcml", xmlrpc.tests)
     v = component.getMultiAdapter((ob, request), name='test2')
     v = ProxyFactory(v)
     self.assertEqual(v.index(), 'V1 here')
     self.assertRaises(Exception, getattr, v, 'action')