def testGlobalInVirtualHost(self):
     req = TestRequest()
     req.setVirtualHostRoot(['x', 'y'])
     r = Resource(req)
     req._vh_root = support.site
     r.__parent__ = support.site
     r.__name__ = 'foo'
     self.assertEqual(r(), 'http://127.0.0.1/x/y/@@/foo')
示例#2
0
 def testGlobalInVirtualHost(self):
     req = TestRequest()
     req.setVirtualHostRoot(['x', 'y'])
     r = Resource(req)
     req._vh_root = support.site
     r.__parent__ = support.site
     r.__name__ = 'foo'
     self.assertEquals(r(), 'http://127.0.0.1/x/y/@@/foo')
 def testGlobal(self):
     req = TestRequest()
     r = Resource(req)
     req._vh_root = support.site
     r.__parent__ = support.site
     r.__name__ = 'foo'
     self.assertEqual(r(), 'http://127.0.0.1/@@/foo')
     r.__name__ = '++resource++foo'
     self.assertEqual(r(), 'http://127.0.0.1/@@/foo')
示例#4
0
 def testGlobal(self):
     req = TestRequest()
     r = Resource(req)
     req._vh_root = support.site
     r.__parent__ = support.site
     r.__name__ = 'foo'
     self.assertEquals(r(), 'http://127.0.0.1/@@/foo')
     r.__name__ = '++resource++foo'
     self.assertEquals(r(), 'http://127.0.0.1/@@/foo')
    def testResourceUrl(self):
        # fake IAbsoluteURL adapter
        def resourceBase(site, request):
            return 'http://cdn.example.com'
        component.provideAdapter(
            resourceBase,
            (zope.component.interfaces.ISite, TestRequest),
            IAbsoluteURL, 'resource')

        req = TestRequest()
        r = Resource(req)
        req._vh_root = support.site
        r.__parent__ = support.site
        r.__name__ = 'foo'
        self.assertEqual(r(), 'http://cdn.example.com/@@/foo')
示例#6
0
    def testResourceUrl(self):
        # fake IAbsoluteURL adapter
        def resourceBase(site, request):
            return 'http://cdn.example.com'

        component.provideAdapter(
            resourceBase, (zope.component.interfaces.ISite, TestRequest),
            IAbsoluteURL, 'resource')

        req = TestRequest()
        r = Resource(req)
        req._vh_root = support.site
        r.__parent__ = support.site
        r.__name__ = 'foo'
        self.assertEquals(r(), 'http://cdn.example.com/@@/foo')