[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/ftests - test_vhosting.py:1.3
Marius Gedminas
mgedmin@codeworks.lt
Wed, 16 Apr 2003 02:54:42 -0400
Update of /cvs-repository/Zope3/src/zope/app/traversing/ftests
In directory cvs.zope.org:/tmp/cvs-serv8051/src/zope/app/traversing/ftests
Modified Files:
test_vhosting.py
Log Message:
Added a couple of tests that virtual hosting works for HTTP redirects as well.
=== Zope3/src/zope/app/traversing/ftests/test_vhosting.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/ftests/test_vhosting.py:1.2 Tue Apr 15 08:24:34 2003
+++ Zope3/src/zope/app/traversing/ftests/test_vhosting.py Wed Apr 16 02:54:42 2003
@@ -80,6 +80,14 @@
'"https://otherhost:443/fake/folders/bar/pt/index.html" />'
'\n</head>\n')
+ 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:443/foo/index.html')
+ self.verifyRedirect('/foo/++vh++https:otherhost:443/bar/++',
+ 'https://otherhost:443/bar/index.html')
+
def test_absolute_url(self):
self.addPage('/pt', u'<span tal:replace="template/@@absolute_url"/>')
self.verify('/pt', 'http://localhost/pt\n')
@@ -135,6 +143,11 @@
result = self.publish(path)
self.assertEquals(result.getStatus(), 200)
self.assertEquals(result.getBody(), content)
+
+ def verifyRedirect(self, path, location):
+ result = self.publish(path)
+ self.assertEquals(result.getStatus(), 302)
+ self.assertEquals(result.getHeader('Location'), location)
def test_suite():