[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests - test_browserpublication.py:1.15 test_http.py:1.3 test_zopepublication.py:1.15

Steve Alexander steve@cat-box.net
Fri, 6 Jun 2003 16:26:01 -0400


Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv16177/src/zope/app/publication/tests

Modified Files:
	test_browserpublication.py test_http.py 
	test_zopepublication.py 
Log Message:
changed to use new interface declarations and api


=== Zope3/src/zope/app/publication/tests/test_browserpublication.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/publication/tests/test_browserpublication.py:1.14	Wed May 28 13:19:22 2003
+++ Zope3/src/zope/app/publication/tests/test_browserpublication.py	Fri Jun  6 16:25:30 2003
@@ -15,7 +15,7 @@
 
 from StringIO import StringIO
 
-from zope.interface import Interface
+from zope.interface import Interface, implements
 
 from zope.component import getService
 from zope.app.services.servicenames import Views
@@ -44,7 +44,7 @@
 
 class DummyPublished:
 
-    __implements__ = IBrowserPublisher
+    implements(IBrowserPublisher)
 
     def publishTraverse(self, request, name):
         if name == 'bruce':
@@ -60,8 +60,6 @@
 
     __Security_checker__ = NamesChecker(["browserDefault", "publishTraverse"])
 
-    __implements__ = DummyPublished.__implements__, BrowserView.__implements__
-
 
 class BasePublicationTests(BasePublicationTests_):
 
@@ -108,8 +106,7 @@
         from persistence import Persistent
 
         class O1(Persistent):
-            __implements__ = I1
-
+            implements(I1)
 
         pub = BrowserPublication(self.db)
 
@@ -164,7 +161,7 @@
     pass
 
 class mydict(dict):
-    __implements__ = I1
+    implements(I1)
 
 
 class BrowserPublicationTests(BasePublicationTests):
@@ -184,7 +181,7 @@
 
         class Adapter:
             " "
-            __implements__ = IBrowserPublisher
+            implements(IBrowserPublisher)
             def __init__(self, context, request):
                 self.context = context
                 self.counter = 0
@@ -209,7 +206,7 @@
     def testAdaptedTraverseDefaultWrapping(self):
         # Test default content and make sure that it's wrapped.
         class Adapter:
-            __implements__ = IBrowserPublisher
+            implements(IBrowserPublisher)
             def __init__(self, context, request):
                 self.context = context
 
@@ -233,7 +230,8 @@
     # XXX we no longer support path parameters! (At least for now)
     def XXXtestTraverseSkinExtraction(self):
         class I1(Interface): pass
-        class C: __implements__ = I1
+        class C:
+            implements(I1)
         class BobView(DummyView): pass
 
         pub = self.klass(self.db)
@@ -267,11 +265,11 @@
         pub = self.klass(self.db)
         class I(Interface): pass
         class C:
-            __implements__ = I
+            implements(I)
         ob = C()
         class V:
             def __init__(self, context, request): pass
-            __implements__ = IBrowserPresentation
+            implements(IBrowserPresentation)
         r = self._createRequest('/@@spam',pub)
         provideView=getService(None, Views).provideView
         provideView(I, 'spam', IBrowserPresentation, [V])


=== Zope3/src/zope/app/publication/tests/test_http.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/publication/tests/test_http.py:1.2	Tue Feb 11 10:59:53 2003
+++ Zope3/src/zope/app/publication/tests/test_http.py	Fri Jun  6 16:25:30 2003
@@ -21,24 +21,23 @@
 from zope.app.tests.placelesssetup import PlacelessSetup
 from StringIO import StringIO
 from zope.component.view import provideView
-from zope.interface import Interface
+from zope.interface import Interface, implements
 from zope.publisher.interfaces.http import IHTTPPresentation
 
 class I(Interface): pass
 class C:
     spammed = 0
-    __implements__ = I
+    implements(I)
 
 class V:
 
     def __init__(self, context, request):
         self.context = context
-    
+
     def SPAM(self):
         self.context.spammed += 1
 
 
-
 class Test(PlacelessSetup, TestCase):
     # Note that zope publication tests cover all of the code but callObject
 
@@ -52,7 +51,6 @@
         pub.callObject(request, ob)
         self.assertEqual(ob.spammed, 1)
 
-        
 
 def test_suite():
     return TestSuite((


=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/publication/tests/test_zopepublication.py:1.14	Tue May 27 10:18:22 2003
+++ Zope3/src/zope/app/publication/tests/test_zopepublication.py	Fri Jun  6 16:25:30 2003
@@ -15,7 +15,7 @@
 import sys
 
 from zope.interface.verify import verifyClass
-from zope.interface.implements import instancesOfObjectImplements
+from zope.interface import implements, classImplements, implementedBy
 
 from zodb.db import DB
 from zodb.storage.mapping import MappingStorage
@@ -86,7 +86,7 @@
         PlacelessSetup.tearDown(self)
 
     def testInterfacesVerify(self):
-        for interface in instancesOfObjectImplements(ZopePublication):
+        for interface in implementedBy(ZopePublication):
             verifyClass(interface, TestPublication)
 
 class Principal:
@@ -96,7 +96,7 @@
     def getDescription(self): return ''
 
 class UnauthenticatedPrincipal(Principal):
-    __implements__ = IUnauthenticatedPrincipal
+    implements(IUnauthenticatedPrincipal)
 
 
 class AuthService1:
@@ -125,7 +125,7 @@
 
 class ServiceManager:
 
-    __implements__ = IServiceService # a dirty lie
+    implements(IServiceService) # a dirty lie
 
     def __init__(self, auth):
         self.auth = auth
@@ -180,10 +180,9 @@
     def testViewOnException(self):
         from zodb.interfaces import ConflictError
         from zope.interface import Interface
-        from zope.interface.implements import implements
         class IConflictError(Interface):
             pass
-        implements(ConflictError, IConflictError)
+        classImplements(ConflictError, IConflictError)
         setDefaultViewName(IConflictError, self.presentation_type, 'name')
         view_text = 'You had a conflict error'
         provideView(IConflictError, 'name', self.presentation_type,
@@ -200,13 +199,12 @@
     def testNoViewOnClassicClassException(self):
         from zodb.interfaces import ConflictError
         from zope.interface import Interface
-        from zope.interface.implements import implements
         from types import ClassType
         class ClassicError:
             __metaclass__ = ClassType
         class IClassicError(Interface):
             pass
-        implements(ClassicError, IClassicError)
+        classImplements(ClassicError, IClassicError)
         setDefaultViewName(IClassicError, self.presentation_type, 'name')
         view_text = 'You made a classic error ;-)'
         provideView(IClassicError, 'name', self.presentation_type,
@@ -226,7 +224,7 @@
     def testExceptionSideEffects(self):
         from zope.publisher.interfaces import IExceptionSideEffects
         class SideEffects:
-            __implements__ = IExceptionSideEffects
+            implements(IExceptionSideEffects)
             def __init__(self, exception):
                 self.exception = exception
             def __call__(self, obj, request, exc_info):
@@ -241,10 +239,9 @@
         factory = SideEffectsFactory()
         from zodb.interfaces import ConflictError
         from zope.interface import Interface
-        from zope.interface.implements import implements
         class IConflictError(Interface):
             pass
-        implements(ConflictError, IConflictError)
+        classImplements(ConflictError, IConflictError)
         provideAdapter(IConflictError, IExceptionSideEffects, factory)
         exception = ConflictError()
         try: