[Zope3-checkins] CVS: Zope3/src/zope/app/traversing/tests - test_vh.py:1.2

Jim Fulton jim at zope.com
Fri Aug 8 15:07:59 EDT 2003


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

Modified Files:
	test_vh.py 
Log Message:
Changed the faux request to reflect merging setApplicationNames into
setVirtualHostRoot.

Changesd assertions to not use _vh_trunc, which is now gone.

Changed to assert failure when missing a closing ++.

Added a required closing ++


=== Zope3/src/zope/app/traversing/tests/test_vh.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/traversing/tests/test_vh.py:1.1	Tue Apr 15 05:37:27 2003
+++ Zope3/src/zope/app/traversing/tests/test_vh.py	Fri Aug  8 14:07:55 2003
@@ -34,17 +34,15 @@
     def setTraversalStack(self, stack):
         self._traversal_stack[:] = list(stack)
 
-    def setApplicationNames(self, names):
-        self._app_names = names
-
     def setApplicationServer(self, host, proto='http', port=None):
         host = "%s://%s" % (proto, host)
         if port:
             host = "%s:%s" % (host, port)
         self._app_server = host
 
-    def setVirtualHostRoot(self):
-        self._vh_trunc = len(self._traversed_names) + 1
+    def setVirtualHostRoot(self, names=None):
+        del self._traversed_names[:]
+        self._app_names = names or []
 
 class TestVHNamespace(unittest.TestCase):
 
@@ -59,8 +57,7 @@
 
         self.assertEqual(result, ob)
         self.assertEqual(request._traversal_stack, ['folder1_1'])
-        #self.assertEqual(request._traversed_names, [])
-        self.assertEqual(request._vh_trunc, 2)
+        self.assertEqual(request._traversed_names, [])
         self.assertEqual(request._app_names, ['x', 'y', 'z'])
         self.assertEqual(request._app_server, 'http://server')
 
@@ -70,18 +67,14 @@
         # GET /folder1/folder2/++vh++http:host:80/folder1_1
         request = TestRequest(['folder1', 'folder2'], ['folder1_1'])
         ob = object()
-        result = vh('http:host:80', (), '++vh++http:host:80', ob, request)
+        self.assertRaises(ValueError, vh,
+                          'http:host:80', (), '++vh++http:host:80', ob, request)
 
-        self.assertEqual(result, ob)
-        self.assertEqual(request._traversal_stack, ['folder1_1'])
-        self.assertEqual(request._vh_trunc, 3)
-        #self.assertEqual(request._traversed_names, [])
-        self.assertEqual(request._app_names, [])
 
     def test_vh_host(self):
         from zope.app.traversing.namespace import vh
 
-        request = TestRequest(['folder1'], ['folder1_1'])
+        request = TestRequest(['folder1'], ['folder1_1', '++'])
         ob = object()
         result = vh('http:www.fubarco.com:80', (),
                     '++vh++http:www.fubarco.com:80', ob, request)




More information about the Zope3-Checkins mailing list