[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container/tests - test_adding.py:1.10.6.3 test_contents.py:1.24.6.4

Jim Fulton jim at zope.com
Mon Sep 15 14:12:57 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/browser/container/tests
In directory cvs.zope.org:/tmp/cvs-serv15511/src/zope/app/browser/container/tests

Modified Files:
      Tag: parentgeddon-branch
	test_adding.py test_contents.py 
Log Message:
Got lots of tests to pass.

Added a setitem helper function to be used to help satisfy container
contracts.



=== Zope3/src/zope/app/browser/container/tests/test_adding.py 1.10.6.2 => 1.10.6.3 ===
--- Zope3/src/zope/app/browser/container/tests/test_adding.py:1.10.6.2	Fri Sep 12 15:15:08 2003
+++ Zope3/src/zope/app/browser/container/tests/test_adding.py	Mon Sep 15 14:12:26 2003
@@ -31,28 +31,30 @@
 from zope.component.factory import provideFactory
 from zope.component.interfaces import IFactory
 from zope.component.exceptions import ComponentLookupError
-from zope.interface import implements, Interface
+from zope.interface import implements, Interface, directlyProvides
 from zope.publisher.browser import TestRequest, BrowserView
 from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.app.container.contained import contained
 import zope.security.checker
 from zope.exceptions import ForbiddenAttribute
 from zope.app.interfaces.container import IWriteContainer
+from zope.app.interfaces.container import IContainerNamesContainer
 
 class Root:
     implements(IContainmentRoot)
 
 class Container(dict):
-
     implements(IWriteContainer)
 
-
 class CreationView(BrowserView):
 
     def action(self):
         return 'been there, done that'
 
 
+class Content:
+    pass
+
 class Factory:
 
     implements(IFactory)
@@ -61,7 +63,7 @@
         return ()
 
     def __call__(self):
-        return 'some_content'
+        return Content()
 
 
 class AbsoluteURL(BrowserView):
@@ -91,18 +93,12 @@
         self.assertEqual(view.action(), 'been there, done that')
         self.assertEqual(adding.contentName, 'foo')
 
-        # Make sure we don't have any events yet:
-        self.failIf(getEvents(IObjectModifiedEvent))
-        self.failIf(getEvents(IObjectAddedEvent))
-
-        o = Container() # any old instance will do
+        o = object()
         result = adding.add(o)
 
         # Check the state of the container and result
         self.assertEqual(container["foo"], o)
-        self.assertEqual(result.__parent__, container)
         self.assertEqual(result, o)
-        self.assertEqual(result.__name__, "foo")
 
     def testNoNameGiven(self):
         container = Container()
@@ -156,9 +152,12 @@
         # Note: Passing is None as object name might be okay, if the container
         #       is able to hand out ids itself. Let's not require a content
         #       name to be specified!
+        # For the container, (or really, the chooser, to choose, we have to
+        # marke the container as a ContainerNamesContainer
+        directlyProvides(container, IContainerNamesContainer)
         adding.contentName = None
         adding.action(type_name='foo')
-        self.assert_('chosen' in container)
+        self.assert_('Content' in container)
         
 
     def test_action(self):


=== Zope3/src/zope/app/browser/container/tests/test_contents.py 1.24.6.3 => 1.24.6.4 ===
--- Zope3/src/zope/app/browser/container/tests/test_contents.py:1.24.6.3	Fri Sep 12 16:46:25 2003
+++ Zope3/src/zope/app/browser/container/tests/test_contents.py	Mon Sep 15 14:12:26 2003
@@ -198,8 +198,8 @@
         fc.pasteObjects()
         self.failIf('document1' not in container)
         self.failIf('document2' not in container)
-        self.failIf('copy_of_document1' not in container)
-        self.failIf('copy_of_document2' not in container)
+        self.failIf('document1-2' not in container)
+        self.failIf('document2-2' not in container)
 
     def testCopyFolder(self):
         container = traverse(self.rootFolder, 'folder1')
@@ -209,7 +209,7 @@
         fc.copyObjects()
         fc.pasteObjects()
         self.failIf('folder1_1' not in container)
-        self.failIf('copy_of_folder1_1' not in container)
+        self.failIf('folder1_1-2' not in container)
 
     def testCopyFolder2(self):
         container = traverse(self.rootFolder, '/folder1/folder1_1')
@@ -219,7 +219,7 @@
         fc.copyObjects()
         fc.pasteObjects()
         self.failIf('folder1_1_1' not in container)
-        self.failIf('copy_of_folder1_1_1' not in container)
+        self.failIf('folder1_1_1-2' not in container)
 
     def testCopyFolder3(self):
         container = traverse(self.rootFolder, '/folder1/folder1_1')




More information about the Zope3-Checkins mailing list