[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests - AdderBaseTests.py:1.1.2.7 testContents.py:1.1.2.4

Jim Fulton jim@zope.com
Fri, 7 Jun 2002 10:41:37 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv12187/lib/python/Zope/App/OFS/Container/Views/Browser/tests

Modified Files:
      Tag: Zope-3x-branch
	AdderBaseTests.py testContents.py 
Log Message:
Merging in Zope3InWonderland-branch, which implemented the following
proposals (see
http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/OldProposals): 
- RenameAllowToRequire

- GroupClassRelatedDirectivesInClassDirective

- ViewInterfaceAndSimplification

- ConsistentUseOfSpacesAsDelimitersInZCMLAttributes

- TwoArgumentViewConstructors

- ImplementsInZCML

- SimpleViewCreationInZCML

- RemoveGetView

- ReplaceProtectWithAllow

- ViewMethodsAsViews

- MergeProtectionAndComponentDefinitions

There were also various security fixes resulting of better integration
of security with components.


=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/AdderBaseTests.py 1.1.2.6 => 1.1.2.7 ===
     """
     
-    def testNonesuch( self ):
+    def testNonesuch(self):
         """
             Do we get the correct information back when no
             addables have been registered?
@@ -47,75 +47,75 @@
         info_list = fa.listAddableInfo()
         self.failIf(info_list)
 
-    def testHaveSome( self ):
+    def testHaveSome(self):
         """
             Do we get the correct information back when no
             addables have been registered?
         """
-        data = [ ( 'foo', 'Foo', 'Foo Thingies' )
-               , ( 'bar', 'Bar', 'Barflies' )
-               , ( 'baz', 'Baz', 'Bazzing Around' )
+        data = [ ('foo', 'Foo', 'Foo Thingies')
+               , ('bar', 'Bar', 'Barflies')
+               , ('baz', 'Baz', 'Bazzing Around')
                ]
 
         addables = self._TestAdderView__registry()
         from Zope.ComponentArchitecture.tests.TestFactory import ClassFactoryWrapper
         for datum in data:
-            apply(getService(None,addables).provideAddable, datum, {} )
+            apply(getService(None,addables).provideAddable, datum, {})
             getService(None,"Factories").provideFactory(datum[0], ClassFactoryWrapper(Foo))
         container = self._TestView__newContext()
-        fa = self._TestView__newView( container )
+        fa = self._TestView__newView(container)
         info_list = fa.listAddableInfo()
-        self.assertEquals( len( info_list ), len( data ) )
+        self.assertEquals(len(info_list), len(data))
 
-        id_list = map( lambda x: x.id, info_list )
-        self.assert_( 'foo' in id_list )
-        self.assert_( 'bar' in id_list )
-        self.assert_( 'baz' in id_list )
-
-        title_list = map( lambda x: x.title, info_list )
-        self.assert_( 'Foo' in title_list )
-        self.assert_( 'Bar' in title_list )
-        self.assert_( 'Baz' in title_list )
+        id_list = map(lambda x: x.id, info_list)
+        self.assert_('foo' in id_list)
+        self.assert_('bar' in id_list)
+        self.assert_('baz' in id_list)
+
+        title_list = map(lambda x: x.title, info_list)
+        self.assert_('Foo' in title_list)
+        self.assert_('Bar' in title_list)
+        self.assert_('Baz' in title_list)
 
-    def testNonesuchAction( self ):
+    def testNonesuchAction(self):
         """
             Can we get add an object back when no classes have
             been registered?
         """
         container = self._TestView__newContext()
-        fa = self._TestView__newView( container )
-        self.assertRaises( ComponentLookupError, fa.action, type_name='foo', id='foo_123' )
+        fa = self._TestView__newView(container)
+        self.assertRaises(ComponentLookupError, fa.action, type_name='foo', id='foo_123')
 
-    def testHaveSomeAction( self ):
+    def testHaveSomeAction(self):
         """
             Can we get add an object back when some classes have
             been registered?
         """
         container = self._TestView__newContext()
-        fa = self._TestView__newView( container )
+        fa = self._TestView__newView(container)
         provideClass(self._TestAdderView__registry(),
                      qualified_name='Zope.App.OFS.tests.testContainerAdd.Foo',
                      _class=Foo,
                      permission=AddPermission,
                      title='Foo'
-                     )
+                    )
         provideClass(self._TestAdderView__registry(),
                      qualified_name='Zope.App.OFS.tests.testContainerAdd.Bar',
                      _class=Bar,
                      permission=AddPermission,
                      title='Bar'
-                     )
+                    )
         provideClass(self._TestAdderView__registry(),
                      qualified_name='Zope.App.OFS.tests.testContainerAdd.Baz',
                      _class=Baz,
                      permission=AddPermission,
                      title='Baz',
-                     )
+                    )
 
         container = self._TestView__newContext()
-        fa = self._TestView__newView( container )
+        fa = self._TestView__newView(container)
         info_list = fa.listAddableInfo()
-        self.assertEquals( len( info_list ), 3 )
+        self.assertEquals(len(info_list), 3)
 
 class BaseAddingTest:
     """Base adding tests
@@ -138,7 +138,7 @@
                      _class=container.__class__,
                      permission=AddPermission,
                      title='Container',
-                     )
+                    )
 
     def testAdding(self):
         """
@@ -146,25 +146,25 @@
             object fail?
         """
         container = self._TestView__newContext()
-        fa = self._TestView__newView( container )
-        fa.action( type_name='Zope.App.OFS.Container', id='foo' )
+        fa = self._TestView__newView(container)
+        fa.action(type_name='Zope.App.OFS.Container', id='foo')
 
-        self.assertEquals( len( container.objectIds() ), 1 )
-        self.assertEquals( container.objectIds()[0], 'foo' )
-        self.assertEquals( len( container.objectValues() ), 1 )
-        self.assertEquals( container.objectValues()[0].__class__,
-                           container.__class__ )
+        self.assertEquals(len(container.objectIds()), 1)
+        self.assertEquals(container.objectIds()[0], 'foo')
+        self.assertEquals(len(container.objectValues()), 1)
+        self.assertEquals(container.objectValues()[0].__class__,
+                           container.__class__)
 
-    def testDuplicates( self ):
+    def testDuplicates(self):
         """
             Does addition of a new object with the same ID as an existing
             object fail?
         """
         container = self._TestView__newContext()
         fa = self._TestView__newView(container)
-        fa.action( type_name='Zope.App.OFS.Container', id='foo' )
+        fa.action(type_name='Zope.App.OFS.Container', id='foo')
 
-        self.assertRaises( DuplicateIDError
+        self.assertRaises(DuplicateIDError
                          , fa.action
                          ,  type_name='Zope.App.OFS.Container'
                          , id='foo'


=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testContents.py 1.1.2.3 => 1.1.2.4 ===
     def _TestView__newView(self, container):
         from Zope.App.OFS.Container.Views.Browser.Contents import Contents
-        return Contents(container)
+        return Contents(container, None)
 
 def test_suite():
     return TestSuite((