[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests - test_icondirective.py:1.10.6.1 test_resource.py:1.5.6.2

Jim Fulton jim at zope.com
Tue Sep 9 12:47:38 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/publisher/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv13092/src/zope/app/publisher/browser/tests

Modified Files:
      Tag: parentgeddon-branch
	test_icondirective.py test_resource.py 
Log Message:
got more tests to pass

=== Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py 1.10 => 1.10.6.1 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py:1.10	Sun Aug 17 02:07:35 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_icondirective.py	Tue Sep  9 11:47:07 2003
@@ -30,6 +30,8 @@
 from zope.component import queryView, getView, getResource
 from zope.configuration.exceptions import ConfigurationError
 from zope.interface import implements
+from zope.app.interfaces.services.service import ISite
+from zope.app.interfaces.traversing import IContainmentRoot
 
 import zope.app.publisher.browser
 
@@ -45,9 +47,10 @@
 request = TestRequest(IBrowserPresentation)
 
 class Ob:
-    implements(IC)
+    implements(IC, ISite, IContainmentRoot)
 
 ob = Ob()
+request._vh_root = ob
 
 def defineCheckers():
     # define the appropriate checker for a FileResource for these tests
@@ -82,14 +85,12 @@
         rname = 'zope-component-tests-views-IC-zmi_icon.gif'
         self.assertEqual(
             view(),
-            '<img src="/@@/%s" alt="IC" width="16" height="16" border="0" />'
+            '<img src="http://127.0.0.1/@@/%s" alt="IC" '
+            'width="16" height="16" border="0" />'
             % rname)
 
         resource = getResource(ob, rname, request)
 
-        # Resources come ready-wrapped from the factory
-        #resource = ProxyFactory(resource)
-
         self.assertRaises(Forbidden, getattr, resource, '_testData')
         resource = removeAllProxies(resource)
         self.assertEqual(resource._testData(), open(path, 'rb').read())
@@ -115,7 +116,8 @@
         rname = "zmi_icon_res"
         self.assertEqual(
             view(),
-            '<img src="/@@/%s" alt="IC" width="16" height="16" border="0" />'
+            '<img src="http://127.0.0.1/@@/%s" alt="IC" width="16" '
+            'height="16" border="0" />'
             % rname)
 
         resource = getResource(ob, rname, request)


=== Zope3/src/zope/app/publisher/browser/tests/test_resource.py 1.5.6.1 => 1.5.6.2 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_resource.py:1.5.6.1	Mon Sep  8 14:21:46 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_resource.py	Tue Sep  9 11:47:07 2003
@@ -17,39 +17,37 @@
 """
 import unittest
 from zope.app.publisher.browser.resource import Resource
-from zope.component.interfaces import IResourceService
 from zope.interface import implements
 from zope.publisher.browser import TestRequest
+from zope.app.interfaces.services.service import ISite 
+from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.app.interfaces.traversing import IContainmentRoot
 
-class Service:
-    implements(IResourceService)
+class Site:
+    implements(ISite, IContainmentRoot)
 
-class TestResource(unittest.TestCase):
+site = Site()
+        
+class TestResource(PlacelessSetup, unittest.TestCase):
 
     def testGlobal(self):
         req = TestRequest()
         r = Resource(req)
-        r.__parent__ = Service()
+        req._vh_root = site
+        r.__parent__ = site
         r.__name__ = 'foo'
-        self.assertEquals(r(), '/@@/foo')
+        self.assertEquals(r(), 'http://127.0.0.1/@@/foo')
         r.__name__ = '++resource++foo'
-        self.assertEquals(r(), '/@@/foo')
-
-    def testGlobalWithSkin(self):
-        req = TestRequest()
-        req._presentation_skin = 'bar'
-        r = Resource(req)
-        r.__parent__ = Service()
-        r.__name__ = 'foo'
-        self.assertEquals(r(), '/++skin++bar/@@/foo')
+        self.assertEquals(r(), 'http://127.0.0.1/@@/foo')
 
     def testGlobalInVirtualHost(self):
         req = TestRequest()
         req.setVirtualHostRoot(['x', 'y'])
         r = Resource(req)
-        r.__parent__ = Service()
+        req._vh_root = site
+        r.__parent__ = site
         r.__name__ = 'foo'
-        self.assertEquals(r(), '/x/y/@@/foo')
+        self.assertEquals(r(), 'http://127.0.0.1/x/y/@@/foo')
 
 
 def test_suite():




More information about the Zope3-Checkins mailing list