[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/tests - testObjectName.py:1.3

Steve Alexander steve@cat-box.net
Sat, 15 Jun 2002 16:38:49 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/tests
In directory cvs.zope.org:/tmp/cvs-serv22871/lib/python/Zope/App/ZopePublication/TraversalViews/tests

Modified Files:
	testObjectName.py 
Log Message:
Added a set of convenience functions that you can import from
Zope.App.Traversing.

Fixed a few typos in the ContextWrapper docstrings, and also added
an isWrapper method to Zope/Proxy/IContextWrapper, mainly so that
I can raise nice errors if the convenience functions are passed
an unwrapped object, rather than returning objs or Nones or []s and 
having programs fail at tenuously related other places.


=== Zope3/lib/python/Zope/App/ZopePublication/TraversalViews/tests/testObjectName.py 1.2 => 1.3 ===
 
 from Zope.App.ZopePublication.TraversalViews.ObjectName \
-    import IObjectName, ObjectName, SiteObjectName
-
+    import ObjectNameView, SiteObjectNameView
 
 class IRoot(Interface): pass
 
@@ -49,14 +48,12 @@
         PlacelessSetup.setUp(self)
         provideView = getService(None, "Views").provideView
         provideView(None, 'object_name', IBrowserPresentation,
-                    [ObjectName])
+                    [ObjectNameView])
         provideView(IRoot, 'object_name', IBrowserPresentation,
-                    [SiteObjectName])
+                    [SiteObjectNameView])
                     
         provideAdapter = getService(None, "Adapters").provideAdapter
         provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)    
-        provideAdapter(None, IObjectName, [ObjectName])
-        provideAdapter(IRoot, IObjectName, [ObjectName])
 
     def testViewBadObject(self):
         request = TestRequest()
@@ -79,21 +76,6 @@
         content = ContextWrapper(TrivialContent(), content, name='c')
         view = getView(content, 'object_name', request)
         self.assertEqual(str(view), 'c')
-
-    def testAdapterBadObject(self):
-        adapter = getAdapter(None, IObjectName)
-        self.assertRaises(TypeError, adapter)
-        
-    def testAdapterNoContext(self):
-        adapter = getAdapter(Root(), IObjectName)
-        self.assertRaises(TypeError, adapter)
-    
-    def testAdapterBasicContext(self):
-        content = ContextWrapper(TrivialContent(), Root(), name='a')
-        content = ContextWrapper(TrivialContent(), content, name='b')
-        content = ContextWrapper(TrivialContent(), content, name='c')
-        adapter = getAdapter(content, IObjectName)
-        self.assertEqual(adapter(), 'c')
         
 def test_suite():
     return TestSuite((