[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/ftests - test_vhosting.py:1.2

Albertas Agejevas alga@codeworks.lt
Tue, 15 Apr 2003 08:24:34 -0400


Update of /cvs-repository/Zope3/src/zope/app/traversing/ftests
In directory cvs.zope.org:/tmp/cvs-serv11793/src/zope/app/traversing/ftests

Modified Files:
	test_vhosting.py 
Log Message:
Added virtual hosting support to resources, complete with unit tests
and functional tests.



=== Zope3/src/zope/app/traversing/ftests/test_vhosting.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/traversing/ftests/test_vhosting.py:1.1	Tue Apr 15 05:37:27 2003
+++ Zope3/src/zope/app/traversing/ftests/test_vhosting.py	Tue Apr 15 08:24:34 2003
@@ -21,7 +21,9 @@
 from zope.app.content.zpt import ZPTPage
 from zope.app.content.folder import Folder
 from transaction import get_transaction
-
+from zope.component.resource import provideResource
+from zope.publisher.interfaces.browser import IBrowserPresentation
+from zope.app.publisher.browser.resource import Resource
 
 class TestVirtualHosting(BrowserTestCase):
 
@@ -95,10 +97,16 @@
                     'http://localhost/pt\n')
         self.verify('/foo/bar/++vh++https:otherhost:443/pt',
                     'https://otherhost:443/pt\n')
-        self.verify('/foo//++vh++https:otherhost:443/fake/folders/++/bar/pt',
+        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
                     'https://otherhost:443/fake/folders/bar/pt\n')
 
-        # XXX write test for urls generated by resources
+    def test_resources(self):
+        provideResource('quux', IBrowserPresentation, Resource)
+        self.addPage('/foo/bar/pt',
+                     u'<span tal:replace="context/@@/quux" />')
+        self.verify('/foo/bar/pt', '/@@/quux\n')
+        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
+                    '/fake/folders/@@/quux\n')
 
     def createFolders(self, path):
         """addFolders('/a/b/c/d') would traverse and/or create three nested