[Zope3-checkins] CVS: Zope3/src/zope/app/browser/tests - test_absoluteurl.py:1.8
Marius Gedminas
mgedmin@codeworks.lt
Mon, 28 Apr 2003 09:14:51 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv25303/src/zope/app/browser/tests
Modified Files:
test_absoluteurl.py
Log Message:
Virtual hosting did not work correctly in all cases (e.g. service configuration
paths did not have leading path elements truncated when they should have).
This is now fixed by adding a method getVirtualHostRoot to IVirtualHostRequest
and making AbsoluteURL views use that for identifying the virtual host root
instead of relying on special context wrappers. Also added a functional test
to prevent regressions.
=== Zope3/src/zope/app/browser/tests/test_absoluteurl.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/tests/test_absoluteurl.py:1.7 Tue Apr 15 06:57:08 2003
+++ Zope3/src/zope/app/browser/tests/test_absoluteurl.py Mon Apr 28 09:14:20 2003
@@ -132,7 +132,28 @@
request = TestRequest()
request.setViewType(IBrowserPresentation)
- content = ContextWrapper(TrivialContent(), Root(), name='a')
+ vh_root = TrivialContent()
+ content = ContextWrapper(vh_root, Root(), name='a')
+ request._vh_root = ContextWrapper(vh_root, Root(), name='a')
+ content = ContextWrapper(TrivialContent(), content, name='b')
+ content = ContextWrapper(TrivialContent(), content, name='c')
+ view = getView(content, 'absolute_url', request)
+ self.assertEqual(str(view), 'http://foobar.com/b/c')
+
+ breadcrumbs = view.breadcrumbs()
+ self.assertEqual(breadcrumbs,
+ ({'name': '', 'url': 'http://foobar.com'},
+ {'name': 'b', 'url': 'http://foobar.com/b'},
+ {'name': 'c', 'url': 'http://foobar.com/b/c'},
+ ))
+
+ def testVirtualHostingWithVHElements(self):
+ request = TestRequest()
+ request.setViewType(IBrowserPresentation)
+
+ vh_root = TrivialContent()
+ content = ContextWrapper(vh_root, Root(), name='a')
+ request._vh_root = ContextWrapper(vh_root, Root(), name='a')
content = ContextWrapper(TrivialContent(), content,
name='.',
side_effect_name="++vh++abc")
@@ -153,6 +174,7 @@
request.setViewType(IBrowserPresentation)
root = Root()
+ request._vh_root = ContextWrapper(root, root, name='')
content = ContextWrapper(root, root,
name='.',
side_effect_name="++vh++abc")