[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator/tests - testIInstanceFactory.py:1.1.4.1.14.1

Jim Fulton jim@zope.com
Wed, 29 May 2002 11:10:06 -0400


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

Modified Files:
      Tag: Zope3InWonderland-branch
	testIInstanceFactory.py 
Log Message:
- Added permission_id attribute to adapter and utility directives.

- Got rid of old getView, getResource, and getDefaultViewName.
  Renamed getRequestView to getView (and so on).

  Changed view interface to use context, rather than getContext.

  Introduced notion of presentation types (e.g. IBrowserPresentation, 
  which is cleaner than IBrowserPublisher).

- Began converting to get/queryFoo, which is much nicer.

- Many formatting fixups.



=== Zope3/lib/python/Zope/App/Formulator/tests/testIInstanceFactory.py 1.1.4.1 => 1.1.4.1.14.1 ===
 # 
 ##############################################################################
-"""
-This suite will test whether the IInstanceFactory will work correctly. In
-order to save some dependencies, we will implement a stub for the test.
-
-$Id$
-"""
-
-import unittest
-from Zope.App.Formulator.IInstanceFactory import IInstanceFactory
-
-
-class ContentObject:
-    """Content Object stub that will provide the context fir the
-       InstanceFactory"""
-    pass
-
-
-class Factory:
-    """InstanceFactory stub."""
-
-    __implements__ = IInstanceFactory
-
-
-    context = None
-
-    ############################################################
-    # Implementation methods for interface
-    # Zope.App.Formulator.IInstanceFactory.
-
-    def __call__(self, context):
-        '''See interface IInstanceFactory'''
-        self.realize(context)
-
-
-    def getContext(self):
-        '''See interface IInstanceFactory'''
-        return self.context
-
-
-    def realize(self, context):
-        '''See interface IInstanceFactory'''
-        self.context = context
-    #
-    ############################################################
-
-
-
-class Test(unittest.TestCase):
-
-
-    def testRealize(self):
-        context = ContentObject()
-        factory = Factory()
-        factory.realize(context)
-        self.assertEqual(factory.context, context)
-
-
-    def testCall(self):
-        context = ContentObject()
-        factory = Factory()
-        factory(context)
-        self.assertEqual(factory.context, context)
-
-
-    def testGetContext(self):
-        context = ContentObject()
-        factory = Factory()
-        factory.context = context
-        self.assertEqual(factory.getContext(), context)
-
-        
-
-def test_suite():
-    loader = unittest.TestLoader()
-    return loader.loadTestsFromTestCase(Test)
-
-
-if __name__=='__main__':
-    unittest.TextTestRunner().run(test_suite())
-
+"""
+This suite will test whether the IInstanceFactory will work correctly. In
+order to save some dependencies, we will implement a stub for the test.
+
+$Id$
+"""
+
+import unittest
+from Zope.App.Formulator.IInstanceFactory import IInstanceFactory
+
+
+class ContentObject:
+    """Content Object stub that will provide the context fir the
+       InstanceFactory"""
+    pass
+
+
+class Factory:
+    """InstanceFactory stub."""
+
+    __implements__ = IInstanceFactory
+
+
+    context = None
+
+    ############################################################
+    # Implementation methods for interface
+    # Zope.App.Formulator.IInstanceFactory.
+
+    def __call__(self, context):
+        '''See interface IInstanceFactory'''
+        self.realize(context)
+
+    def realize(self, context):
+        '''See interface IInstanceFactory'''
+        self.context = context
+    #
+    ############################################################
+
+
+
+class Test(unittest.TestCase):
+
+
+    def testRealize(self):
+        context = ContentObject()
+        factory = Factory()
+        factory.realize(context)
+        self.assertEqual(factory.context, context)
+
+
+    def testCall(self):
+        context = ContentObject()
+        factory = Factory()
+        factory(context)
+        self.assertEqual(factory.context, context)
+
+
+    def testGetContext(self):
+        context = ContentObject()
+        factory = Factory()
+        factory.context = context
+        self.assertEqual(factory.context, context)
+
+        
+
+def test_suite():
+    loader = unittest.TestLoader()
+    return loader.loadTestsFromTestCase(Test)
+
+
+if __name__=='__main__':
+    unittest.TextTestRunner().run(test_suite())
+