[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins/rotterdam/tests - test_xmlnavigationviews.py:1.4

Steve Alexander steve@cat-box.net
Thu, 2 Jan 2003 10:03:24 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/skins/rotterdam/tests
In directory cvs.zope.org:/tmp/cvs-serv29577/src/zope/app/browser/skins/rotterdam/tests

Modified Files:
	test_xmlnavigationviews.py 
Log Message:
provided page view in test. changed test for no getParent() to explicitly
say 'parent is not None', as just 'if parent:' fails for an empty folder,
as it is basically an empty sequence.


=== Zope3/src/zope/app/browser/skins/rotterdam/tests/test_xmlnavigationviews.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/skins/rotterdam/tests/test_xmlnavigationviews.py:1.3	Thu Jan  2 09:07:27 2003
+++ Zope3/src/zope/app/browser/skins/rotterdam/tests/test_xmlnavigationviews.py	Thu Jan  2 10:03:21 2003
@@ -27,6 +27,7 @@
 from zope.app.browser.skins.rotterdam.tests import util
 from zope.app.browser.skins.rotterdam.xmlobject \
     import ReadContainerXmlObjectView
+from zope.app.interfaces.container import IReadContainer
 from zope.app.browser.skins.rotterdam.xmlobject import XmlObjectView
 from zope.publisher.browser import TestRequest
 
@@ -54,15 +55,25 @@
 
         from zope.app.content.file import File
         from zope.proxy.context import ContextWrapper
-        self.file1 = File()
+        file1 = File()
         self.rootFolder.setObject("file1", self.folder1_1_1)
-        self.file1 = ContextWrapper(self.file1, self.folder1_1_1,
-             name = "file1")
-             
-#        treeView = XmlObjectView(self.file1, TestRequest()).singleBranchTree
-#        check_xml(treeView(), util.read_output('test5.xml'))
-
-
+        self.file1 = ContextWrapper(file1, self.folder1_1_1, name = "file1")
+        from zope.component.view import provideView
+        from zope.publisher.interfaces.browser import IBrowserPresentation
+        from zope.publisher.interfaces.browser import IBrowserPublisher
+        class ReadContainerView(ReadContainerXmlObjectView):
+            __implements__ = (IBrowserPublisher, 
+                              ReadContainerXmlObjectView.__implements__)
+            def browserDefault(self, request):
+                return self, ()
+            def publishTraverse(self, request, name):
+                raise NotFoundError(self, name, request)
+            def __call__(self):
+                return self.singleBranchTree()
+        provideView(IReadContainer, 'singleBranchTree.xml',
+                    IBrowserPresentation, ReadContainerView)
+        treeView = XmlObjectView(self.file1, TestRequest()).singleBranchTree
+        #check_xml(treeView(), util.read_output('test5.xml'))
 
 
 def test_suite():