[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests - testAdding.py:1.6 testContents.py:1.7
Jim Fulton
jim@zope.com
Mon, 18 Nov 2002 18:53:00 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv25757/Views/Browser/tests
Modified Files:
testAdding.py testContents.py
Log Message:
Created an adapter that provides Zope framework services for
containers, including:
- Context wrapping
- Event generation
- Add and delete hooks
Modified the adding and contents views to use the new adapter.
Added interfaces defining add and delete hooks.
=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testAdding.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testAdding.py:1.5 Mon Nov 18 08:40:38 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testAdding.py Mon Nov 18 18:52:59 2002
@@ -17,7 +17,7 @@
"""
from unittest import TestCase, main, makeSuite
-
+from Zope.ComponentArchitecture.GlobalAdapterService import provideAdapter
from Zope.App.OFS.Container.Views.Browser.Adding import Adding
from Zope.App.OFS.Container.IAdding import IAdding
from Zope.App.tests.PlacelessSetup import PlacelessSetup
@@ -30,7 +30,16 @@
from Zope.Event.tests.PlacelessSetup import getEvents
from Zope.Event.IObjectEvent import IObjectAddedEvent, IObjectModifiedEvent
+from Zope.App.OFS.Container.IZopeContainer import IZopeContainer
+from Zope.App.OFS.Container.IContainer import IContainer
+from Zope.App.OFS.Container.ZopeContainerAdapter import ZopeContainerAdapter
+
+
+
class Container:
+
+ __implements__ = IContainer
+
def __init__(self):
self._data = {}
@@ -48,14 +57,17 @@
class Test(PlacelessSetup, TestCase):
+ def setUp(self):
+ PlacelessSetup.setUp(self)
+ provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
+
def test(self):
container = Container()
request = TestRequest()
adding = Adding(container, request)
provideView(IAdding, "Thing", IBrowserPresentation, CreationView)
-
self.assertEqual(adding.contentName, None)
- view = adding.publishTraverse(request, 'Thing=foo')
+ view = adding.publishTraverse(request, 'Thing=foo')
self.assertEqual(view.action(), 'been there, done that')
self.assertEqual(adding.contentName, 'foo')
@@ -65,7 +77,7 @@
o = Container() # any old instance will do
result = adding.add(o)
-
+
# Make sure the right events were generated:
self.failUnless(
getEvents(IObjectAddedEvent,
=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testContents.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testContents.py:1.6 Fri Oct 4 15:52:25 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/tests/testContents.py Mon Nov 18 18:52:59 2002
@@ -21,10 +21,10 @@
from Zope.App.tests.PlacelessSetup import PlacelessSetup
from Zope.ComponentArchitecture.GlobalAdapterService import provideAdapter
-from Zope.I18n.IUserPreferredCharsets import IUserPreferredCharsets
+from Zope.App.OFS.Container.IZopeContainer import IZopeContainer
+from Zope.App.OFS.Container.IContainer import IContainer
+from Zope.App.OFS.Container.ZopeContainerAdapter import ZopeContainerAdapter
-from Zope.Publisher.HTTP.HTTPRequest import IHTTPRequest
-from Zope.Publisher.HTTP.HTTPCharsets import HTTPCharsets
from Zope.Event.tests.PlacelessSetup import getEvents
from Zope.Event.IObjectEvent import IObjectRemovedEvent, IObjectModifiedEvent
from Interface import Interface
@@ -43,7 +43,7 @@
def setUp(self):
PlacelessSetup.setUp(self)
- provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+ provideAdapter(IContainer, IZopeContainer, ZopeContainerAdapter)
def testInfo(self):