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')
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')
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')
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')