[Zope3-checkins] SVN: Zope3/branches/srichter-blow-services/src/zope/app/ yipee, pluggable auth is already fixed, at least the unit tests are.

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jan 14 17:31:22 EST 2005


Log message for revision 28838:
  yipee, pluggable auth is already fixed, at least the unit tests are.
  

Changed:
  U   Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py
  A   Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/
  U   Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py
  D   Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/xxx_tests/
  U   Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py

-=-
Modified: Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py	2005-01-14 21:55:23 UTC (rev 28837)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/__init__.py	2005-01-14 22:31:22 UTC (rev 28838)
@@ -48,6 +48,7 @@
 
 from zope.app.servicenames import Authentication
 from zope.app.security.interfaces import ILoginPassword
+from zope.app.component.localservice import queryNextService
 
 from interfaces import IUserSchemafied, IPluggableAuthenticationService
 from interfaces import IPrincipalSource, ILoginPasswordPrincipalSource
@@ -88,8 +89,6 @@
                 if principal is not None:
                     return principal
 
-        # Import placed here, to not require BBB with older code
-        from zope.app.component.localservice import queryNextService
         next = queryNextService(self, Authentication, None)
         if next is not None:
             return next.authenticate(request)

Copied: Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests (from rev 28825, Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/xxx_tests)

Modified: Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/xxx_tests/test_pluggableauth.py	2005-01-13 16:28:47 UTC (rev 28825)
+++ Zope3/branches/srichter-blow-services/src/zope/app/pluggableauth/tests/test_pluggableauth.py	2005-01-14 22:31:22 UTC (rev 28838)
@@ -20,8 +20,8 @@
 from zope.interface.verify import verifyObject
 
 from zope.app import zapi
-from zope.app.testing import ztapi, setup
-import zope.app.component.testing as placefulsetup
+from zope.app.tests import ztapi, setup
+import zope.app.site.tests as placefulsetup
 
 from zope.app.security.interfaces import PrincipalLookupError
 from zope.publisher.interfaces.http import IHTTPCredentials
@@ -37,7 +37,7 @@
 
 from zope.publisher.browser import TestRequest as Request
 
-from zope.app.testing.placelesssetup import setUp, tearDown
+from zope.app.tests.placelesssetup import setUp, tearDown
 
 import base64
 

Modified: Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py	2005-01-14 21:55:23 UTC (rev 28837)
+++ Zope3/branches/srichter-blow-services/src/zope/app/testing/setup.py	2005-01-14 22:31:22 UTC (rev 28838)
@@ -21,6 +21,32 @@
 from zope.app.testing import ztapi
 from zope.interface import classImplements
 
+
+#############################################################################
+# BBB: Goes away in 3.3
+
+from zope.component.bbb.service import IService
+from zope.app.site.interfaces import ISimpleService
+from zope.app.component.site import UtilityRegistration
+
+def addService(servicemanager, name, service, suffix=''):
+    """Add a service to a service manager
+
+    This utility is useful for tests that need to set up services.
+    """
+    # Most local services implement ISimpleService in ZCML; therefore make
+    # sure we got it here as well.
+    zope.interface.directlyProvides(service, ISimpleService)
+
+    default = zapi.traverse(servicemanager, 'default')
+    default[name+suffix] = service
+    registration = UtilityRegistration(name, IService, service, default)
+    key = default.registrationManager.addRegistration(registration)
+    zapi.traverse(default.registrationManager, key).status = ActiveStatus
+    return default[name+suffix]
+
+#############################################################################
+
 #------------------------------------------------------------------------
 # Annotations
 from zope.app.annotation.attribute import AttributeAnnotations

Modified: Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py	2005-01-14 21:55:23 UTC (rev 28837)
+++ Zope3/branches/srichter-blow-services/src/zope/app/tests/__init__.py	2005-01-14 22:31:22 UTC (rev 28838)
@@ -5,13 +5,14 @@
 # BBB: backward-comptibility; 12/18/2004
 
 import sys
-from zope.deprecation.deprecation import DeprecatedModule 
+#from zope.deprecation.deprecation import DeprecatedModule 
 import zope.app
 
 def deprecate(module):
-    return DeprecatedModule(module,
-                            'Test setup code moved from zope.app.tests to '
-                            'zope.app.testing. This will go away in Zope 3.3.')
+    return module
+#    return DeprecatedModule(module,
+#                            'Test setup code moved from zope.app.tests to '
+#                            'zope.app.testing. This will go away in Zope 3.3.')
 
 
 from zope.app.testing import placelesssetup



More information about the Zope3-Checkins mailing list