[Checkins] SVN: zope.traversing/trunk/ Made virtual hosting tests compatible with zope.publisher 3.9. Redirecting to a different host requires an explicit `trusted` redirect now.

Hanno Schlichting hannosch at hannosch.eu
Fri Aug 28 19:51:57 EDT 2009


Log message for revision 103368:
  Made virtual hosting tests compatible with zope.publisher 3.9. Redirecting to a different host requires an explicit `trusted` redirect now.
  

Changed:
  U   zope.traversing/trunk/CHANGES.txt
  U   zope.traversing/trunk/src/zope/traversing/tests/test_vhosting.py

-=-
Modified: zope.traversing/trunk/CHANGES.txt
===================================================================
--- zope.traversing/trunk/CHANGES.txt	2009-08-28 23:07:08 UTC (rev 103367)
+++ zope.traversing/trunk/CHANGES.txt	2009-08-28 23:51:56 UTC (rev 103368)
@@ -5,7 +5,8 @@
 3.7.2 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Made virtual hosting tests compatible with zope.publisher 3.9. Redirecting
+  to a different host requires an explicit `trusted` redirect now.
 
 
 3.7.1 (2009-06-16)

Modified: zope.traversing/trunk/src/zope/traversing/tests/test_vhosting.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/tests/test_vhosting.py	2009-08-28 23:07:08 UTC (rev 103367)
+++ zope.traversing/trunk/src/zope/traversing/tests/test_vhosting.py	2009-08-28 23:51:56 UTC (rev 103368)
@@ -49,19 +49,19 @@
         self.verify('/pt', 'http://localhost/pt')
         self.verify('/++vh++/++/pt',
                     'http://localhost/pt')
-        self.verify('/++vh++https:otherhost:443/++/pt',
-                    'https://otherhost/pt')
-        self.verify('/++vh++https:otherhost:443/fake/folders/++/pt',
-                    'https://otherhost/fake/folders/pt')
+        self.verify('/++vh++https:localhost:443/++/pt',
+                    'https://localhost/pt')
+        self.verify('/++vh++https:localhost:443/fake/folders/++/pt',
+                    'https://localhost/fake/folders/pt')
 
         self.addPage('/foo/bar/pt', u'<span tal:replace="request/URL"/>')
         self.verify('/foo/bar/pt', 'http://localhost/foo/bar/pt')
         self.verify('/foo/bar/++vh++/++/pt',
                     'http://localhost/pt')
-        self.verify('/foo/bar/++vh++https:otherhost:443/++/pt',
-                    'https://otherhost/pt')
-        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
-                    'https://otherhost/fake/folders/bar/pt')
+        self.verify('/foo/bar/++vh++https:localhost:443/++/pt',
+                    'https://localhost/pt')
+        self.verify('/foo/++vh++https:localhost:443/fake/folders/++/bar/pt',
+                    'https://localhost/fake/folders/bar/pt')
 
     def test_request_base(self):
         self.addPage('/pt', u'<head></head>')
@@ -71,13 +71,13 @@
         self.verify('/++vh++/++/pt/',
                     '<head>\n<base href="http://localhost/pt" />\n'
                     '</head>')
-        self.verify('/++vh++https:otherhost:443/++/pt/',
+        self.verify('/++vh++https:localhost:443/++/pt/',
                     '<head>\n'
-                    '<base href="https://otherhost/pt" />'
+                    '<base href="https://localhost/pt" />'
                     '\n</head>')
-        self.verify('/++vh++https:otherhost:443/fake/folders/++/pt/',
+        self.verify('/++vh++https:localhost:443/fake/folders/++/pt/',
                     '<head>\n<base href='
-                    '"https://otherhost/fake/folders/pt" />'
+                    '"https://localhost/fake/folders/pt" />'
                     '\n</head>')
 
         self.addPage('/foo/bar/pt', u'<head></head>')
@@ -88,50 +88,50 @@
         self.verify('/foo/bar/++vh++/++/pt/',
                     '<head>\n<base href="http://localhost/pt" />\n'
                     '</head>')
-        self.verify('/foo/bar/++vh++https:otherhost:443/++/pt/',
+        self.verify('/foo/bar/++vh++https:localhost:443/++/pt/',
                     '<head>\n'
-                    '<base href="https://otherhost/pt" />'
+                    '<base href="https://localhost/pt" />'
                     '\n</head>')
-        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt/',
+        self.verify('/foo/++vh++https:localhost:443/fake/folders/++/bar/pt/',
                     '<head>\n<base href='
-                    '"https://otherhost/fake/folders/bar/pt" />'
+                    '"https://localhost/fake/folders/bar/pt" />'
                     '\n</head>')
 
     def test_request_redirect(self):
         self.addPage('/foo/index.html', u'Spam')
         self.verifyRedirect('/foo', 'http://localhost/foo/index.html')
-        self.verifyRedirect('/++vh++https:otherhost:443/++/foo',
-                            'https://otherhost/foo/index.html')
-        self.verifyRedirect('/foo/++vh++https:otherhost:443/bar/++',
-                            'https://otherhost/bar/index.html')
+        self.verifyRedirect('/++vh++https:localhost:443/++/foo',
+                            'https://localhost/foo/index.html')
+        self.verifyRedirect('/foo/++vh++https:localhost:443/bar/++',
+                            'https://localhost/bar/index.html')
 
     def test_absolute_url(self):
         self.addPage('/pt', u'<span tal:replace="template/@@absolute_url"/>')
         self.verify('/pt', 'http://localhost/pt')
         self.verify('/++vh++/++/pt',
                     'http://localhost/pt')
-        self.verify('/++vh++https:otherhost:443/++/pt',
-                    'https://otherhost/pt')
-        self.verify('/++vh++https:otherhost:443/fake/folders/++/pt',
-                    'https://otherhost/fake/folders/pt')
+        self.verify('/++vh++https:localhost:443/++/pt',
+                    'https://localhost/pt')
+        self.verify('/++vh++https:localhost:443/fake/folders/++/pt',
+                    'https://localhost/fake/folders/pt')
 
         self.addPage('/foo/bar/pt',
                      u'<span tal:replace="template/@@absolute_url"/>')
         self.verify('/foo/bar/pt', 'http://localhost/foo/bar/pt')
         self.verify('/foo/bar/++vh++/++/pt',
                     'http://localhost/pt')
-        self.verify('/foo/bar/++vh++https:otherhost:443/++/pt',
-                    'https://otherhost/pt')
-        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
-                    'https://otherhost/fake/folders/bar/pt')
+        self.verify('/foo/bar/++vh++https:localhost:443/++/pt',
+                    'https://localhost/pt')
+        self.verify('/foo/++vh++https:localhost:443/fake/folders/++/bar/pt',
+                    'https://localhost/fake/folders/bar/pt')
 
     def test_absolute_url_absolute_traverse(self):
         self.createObject('/foo/bar/obj', MyObj())
         self.addPage('/foo/bar/pt',
                      u'<span tal:replace="container/obj/pt/@@absolute_url"/>')
         self.verify('/foo/bar/pt', 'http://localhost/foo/bar/pt')
-        self.verify('/foo/++vh++https:otherhost:443/++/bar/pt',
-                    'https://otherhost/bar/pt')
+        self.verify('/foo/++vh++https:localhost:443/++/bar/pt',
+                    'https://localhost/bar/pt')
 
     def test_resources(self):
         browserResource('quux', Resource)
@@ -141,8 +141,8 @@
         self.addPage('/foo/bar/pt',
                      u'<span tal:replace="context/++resource++quux" />')
         self.verify('/foo/bar/pt', 'http://localhost/@@/quux')
-        self.verify('/foo/++vh++https:otherhost:443/fake/folders/++/bar/pt',
-                    'https://otherhost/fake/folders/@@/quux')
+        self.verify('/foo/++vh++https:localhost:443/fake/folders/++/bar/pt',
+                    'https://localhost/fake/folders/@@/quux')
 
     def createFolders(self, path):
         """addFolders('/a/b/c/d') would traverse and/or create three nested



More information about the checkins mailing list