[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py checkin test for subresources

Brian Lloyd brian at zope.com
Wed Jun 22 10:31:33 EDT 2005


Log message for revision 30888:
  checkin test for subresources

Changed:
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py

-=-
Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py	2005-06-22 13:51:19 UTC (rev 30887)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_directoryresource.py	2005-06-22 14:31:33 UTC (rev 30888)
@@ -28,7 +28,7 @@
 from zope.app import zapi
 from zope.app.testing.placelesssetup import PlacelessSetup
 from zope.app.publisher.browser.directoryresource import \
-     DirectoryResourceFactory
+     DirectoryResourceFactory, DirectoryResource
 from zope.app.container.contained import Contained
 from zope.app.publisher.browser.fileresource import FileResource
 from zope.app.publisher.browser.pagetemplateresource import \
@@ -93,6 +93,22 @@
         file = files['test.gif']
         self.assertEquals(file(), 'http://127.0.0.1/@@/test_files/test.gif')
 
+    def testURL3Level(self):
+        request = TestRequest()
+        request._vh_root = support.site
+        ob.__parent__ = support.site
+        ob.__name__ = 'ob'
+        path = os.path.join(test_directory, 'testfiles')
+        files = DirectoryResourceFactory(path, checker, 'test_files')(request)
+        files.__parent__ = ob
+        file = files['test.gif']
+        self.assertEquals(file(), 'http://127.0.0.1/@@/test_files/test.gif')
+        subdir = files['subdir']
+        self.assert_(zapi.isinstance(subdir, DirectoryResource))
+        file = subdir['test.gif']
+        self.assertEquals(file(),
+                          'http://127.0.0.1/@@/test_files/subdir/test.gif')
+
     def testCorrectFactories(self):
         path = os.path.join(test_directory, 'testfiles')
         request = TestRequest()



More information about the Zope3-Checkins mailing list