[Zope-Checkins] CVS: Products/SiteAccess/tests - testVirtualHostMonster.py:1.3

Evan Simpson evan at 4-am.com
Thu Dec 11 14:50:58 EST 2003


Update of /cvs-repository/Products/SiteAccess/tests
In directory cvs.zope.org:/tmp/cvs-serv31545/lib/python/Products/SiteAccess/tests

Modified Files:
	testVirtualHostMonster.py 
Log Message:
Fix VHM tests and make them pass


=== Products/SiteAccess/tests/testVirtualHostMonster.py 1.2 => 1.3 ===
--- Products/SiteAccess/tests/testVirtualHostMonster.py:1.2	Wed Dec 10 12:52:47 2003
+++ Products/SiteAccess/tests/testVirtualHostMonster.py	Thu Dec 11 14:50:27 2003
@@ -73,17 +73,21 @@
             yield '/'.join(vparts), vr, _vh, p, ubase
 
 for i, (vaddr, vr, _vh, p, ubase) in enumerate(gen_cases()):
-    def test(self):
+    def test(self, vaddr=vaddr, vr=vr, _vh=_vh, p=p, ubase=ubase):
         ob = self.traverse('%s/%s/' % (vaddr, p))
-        vhp = '/' + '/'.join([x for x in _vh, p if x])
-        self.assertEqual(ob.absolute_url(), ubase + vhp)
-        self.assertEqual(ob.absolute_url_path(), vhp)
+        sl_vh = (_vh and ('/' + _vh))
+        aup = sl_vh + (p and ('/' + p))
+        self.assertEqual(ob.absolute_url_path(), aup)
+        self.assertEqual(self.app.REQUEST['BASEPATH1'] + '/' + p, aup)
+        self.assertEqual(ob.absolute_url(), ubase + aup)
         self.assertEqual(ob.absolute_url(relative=1), p)
         self.assertEqual(ob.virtual_url_path(), p)
         self.assertEqual(ob.getPhysicalPath(), ('', 'folder', 'doc'))
 
         app = ob.aq_parent.aq_parent
-        self.assertEqual(app.absolute_url(), ubase + '/' + _vh)
+        # The absolute URL doesn't end with a slash
+        self.assertEqual(app.absolute_url(), ubase + sl_vh)
+        # The absolute URL path always begins with a slash
         self.assertEqual(app.absolute_url_path(), '/' + _vh)
         self.assertEqual(app.absolute_url(relative=1), '')
         self.assertEqual(app.virtual_url_path(), '')




More information about the Zope-Checkins mailing list