[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests -
test_directoryresource.py:1.3
Sidnei da Silva
sidnei at x3ng.com.br
Wed Sep 24 13:31:30 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv10935/src/zope/app/publisher/browser/tests
Modified Files:
test_directoryresource.py
Log Message:
Woops. My fix broke the whole resource thing, but all tests passed! Better fix with a test to make sure it doesnt break again
=== Zope3/src/zope/app/publisher/browser/tests/test_directoryresource.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_directoryresource.py:1.2 Wed Sep 24 13:22:07 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_directoryresource.py Wed Sep 24 13:31:30 2003
@@ -28,6 +28,7 @@
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.publisher.browser.directoryresource import \
DirectoryResourceFactory
+from zope.app.container.contained import Contained
from zope.app.publisher.browser.fileresource import FileResource
from zope.app.publisher.browser.pagetemplateresource import \
PageTemplateResource
@@ -44,8 +45,10 @@
class Site:
implements(ISite, IContainmentRoot)
-site = Site()
+class Ob(Contained): pass
+site = Site()
+ob = Ob()
class Test(PlacelessSetup, TestCase):
@@ -80,6 +83,18 @@
path = os.path.join(test_directory, 'testfiles')
files = DirectoryResourceFactory(path, checker)(request)
files.__parent__ = site
+ files.__name__ = 'test_files'
+ file = files['test.gif']
+ self.assertEquals(file(), 'http://127.0.0.1/@@/test_files/test.gif')
+
+ def testURL2Level(self):
+ request = TestRequest()
+ request._vh_root = site
+ ob.__parent__ = site
+ ob.__name__ = 'ob'
+ path = os.path.join(test_directory, 'testfiles')
+ files = DirectoryResourceFactory(path, checker)(request)
+ files.__parent__ = ob
files.__name__ = 'test_files'
file = files['test.gif']
self.assertEquals(file(), 'http://127.0.0.1/@@/test_files/test.gif')
More information about the Zope3-Checkins
mailing list