[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Traversing/tests - testConvenienceFunctions.py:1.8

Steve Alexander steve@cat-box.net
Tue, 26 Nov 2002 14:00:21 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Traversing/tests
In directory cvs.zope.org:/tmp/cvs-serv9580/tests

Modified Files:
	testConvenienceFunctions.py 
Log Message:
Fixed bug in getPhysicalPathString convenience function.
This function was not being unit tested at all!
That's not good.


=== Zope3/lib/python/Zope/App/Traversing/tests/testConvenienceFunctions.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/Traversing/tests/testConvenienceFunctions.py:1.7	Tue Nov 26 08:14:50 2002
+++ Zope3/lib/python/Zope/App/Traversing/tests/testConvenienceFunctions.py	Tue Nov 26 14:00:21 2002
@@ -49,7 +49,7 @@
         folder = C('folder')
         item = C('item')
         
-        self.root =   root
+        self.root =   ContextWrapper(root, None)
         self.folder = ContextWrapper(folder, self.root,   name='folder')
         self.item =   ContextWrapper(item,   self.folder, name='item')
         self.unwrapped_item = item
@@ -119,7 +119,7 @@
         self.assertEqual(
             objectName(self.item),
             'item'
-            )  
+            )
 
     def testObjectNameFromUnwrapped(self):
         from Zope.App.Traversing import objectName
@@ -127,14 +127,14 @@
             TypeError,
             objectName,
             self.unwrapped_item
-            )  
+            )
 
     def testGetParent(self):
         from Zope.App.Traversing import getParent
         self.assertEqual(
             getParent(self.item),
             self.folder
-            )  
+            ) 
 
     def testGetParentFromUnwrapped(self):
         from Zope.App.Traversing import getParent
@@ -142,7 +142,7 @@
             TypeError,
             getParent,
             self.unwrapped_item
-            )  
+            )
 
     def testGetParents(self):
         from Zope.App.Traversing import getParents
@@ -164,6 +164,27 @@
         self.assertEqual(
             getPhysicalPath(self.item),
             ('', 'folder', 'item')
+            )
+
+    def testGetPhysicalPathString(self):
+        from Zope.App.Traversing import getPhysicalPathString
+        self.assertEqual(
+            getPhysicalPathString(self.item),
+            u'/folder/item'
+            )
+
+    def testGetPhysicalPathOfRoot(self):
+        from Zope.App.Traversing import getPhysicalPath
+        self.assertEqual(
+            getPhysicalPath(self.root),
+            ('',)
+            )
+
+    def testGetPhysicalPathStringOfRoot(self):
+        from Zope.App.Traversing import getPhysicalPathString
+        self.assertEqual(
+            getPhysicalPathString(self.root),
+            u'/',
             )
 
     def testGetPhysicalPathFromUnwrapped(self):