[Checkins] SVN: PluggableAuthService/trunk/ - Fixed test breakage induced by use of Z3 pagetemplates in Zope

Jens Vagelpohl jens at dataflake.org
Fri Oct 20 14:41:56 EDT 2006


Log message for revision 70849:
  - Fixed test breakage induced by use of Z3 pagetemplates in Zope
    2.10+ - analogous to Tres' CMF test fixes
  

Changed:
  U   PluggableAuthService/trunk/doc/CHANGES.txt
  U   PluggableAuthService/trunk/plugins/tests/test_DynamicGroupsPlugin.py
  U   PluggableAuthService/trunk/tests/test_exportimport.py
  A   PluggableAuthService/trunk/tests/utils.py

-=-
Modified: PluggableAuthService/trunk/doc/CHANGES.txt
===================================================================
--- PluggableAuthService/trunk/doc/CHANGES.txt	2006-10-20 16:48:11 UTC (rev 70848)
+++ PluggableAuthService/trunk/doc/CHANGES.txt	2006-10-20 18:41:55 UTC (rev 70849)
@@ -10,6 +10,9 @@
 
     Bugs Fixed
 
+      - Fixed test breakage induced by use of Z3 pagetemplates in Zope
+        2.10+.
+
       - BasePlugin: The listInterfaces method only considered the old-style
         __implements__ machinery when determining interfaces provided by
         a plugin instance.

Modified: PluggableAuthService/trunk/plugins/tests/test_DynamicGroupsPlugin.py
===================================================================
--- PluggableAuthService/trunk/plugins/tests/test_DynamicGroupsPlugin.py	2006-10-20 16:48:11 UTC (rev 70848)
+++ PluggableAuthService/trunk/plugins/tests/test_DynamicGroupsPlugin.py	2006-10-20 18:41:55 UTC (rev 70849)
@@ -18,12 +18,11 @@
 """
 import unittest
 
-
 from Products.PluggableAuthService.tests.conformance \
     import IGroupsPlugin_conformance
-
 from Products.PluggableAuthService.tests.conformance \
     import IGroupEnumerationPlugin_conformance
+from Products.PluggableAuthService.tests.utils import _setUpDefaultTraversable
 
 class FauxScript:
 
@@ -52,7 +51,6 @@
                          , IGroupEnumerationPlugin_conformance
                          ):
 
-
     def _getTargetClass( self ):
 
         from Products.PluggableAuthService.plugins.DynamicGroupsPlugin \
@@ -355,6 +353,7 @@
 
     def test_getGroupsForPrincipal_request( self ):
 
+        _setUpDefaultTraversable()
         dpg = self._makeOne( 'ggp_request' )
         principal = FauxPrincipal( 'faux' )
 
@@ -375,6 +374,7 @@
 
     def test_getGroupsForPrincipal_group( self ):
 
+        _setUpDefaultTraversable()
         dpg = self._makeOne( 'ggp_group' )
         principal = FauxPrincipal( 'faux' )
 

Modified: PluggableAuthService/trunk/tests/test_exportimport.py
===================================================================
--- PluggableAuthService/trunk/tests/test_exportimport.py	2006-10-20 16:48:11 UTC (rev 70848)
+++ PluggableAuthService/trunk/tests/test_exportimport.py	2006-10-20 18:41:55 UTC (rev 70849)
@@ -31,6 +31,8 @@
 
 else:
     from Products.GenericSetup.tests.common import BaseRegistryTests
+    from Products.PluggableAuthService.tests.utils import \
+            _setUpDefaultTraversable
 
     from zope.interface import Interface
 
@@ -135,6 +137,8 @@
             from Products.PluginRegistry.PluginRegistry import PluginRegistry
             from Products.PluggableAuthService.exportimport import exportPAS
 
+            _setUpDefaultTraversable()
+
             self._setUpAdapters()
             app, pas = self._initPAS()
             context = DummyExportContext(pas)
@@ -167,6 +171,8 @@
             from Products.PluginRegistry.PluginRegistry import PluginRegistry
             from Products.PluggableAuthService.exportimport import exportPAS
 
+            _setUpDefaultTraversable()
+
             self._setUpAdapters()
             app, pas = self._initPAS()
             csv_aware = TestCSVAware()

Added: PluggableAuthService/trunk/tests/utils.py
===================================================================
--- PluggableAuthService/trunk/tests/utils.py	2006-10-20 16:48:11 UTC (rev 70848)
+++ PluggableAuthService/trunk/tests/utils.py	2006-10-20 18:41:55 UTC (rev 70849)
@@ -0,0 +1,31 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors. All Rights
+# Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this
+# distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" PluggableAuthService unit tests utils
+
+$Id$
+"""
+
+def _setUpDefaultTraversable():
+    # Work around behavior change in Zope 2.10 due to its use of the 
+    # Zope 3 pagetemplates
+    try:
+        from zope.interface import Interface
+        from zope.component import provideAdapter
+        from zope.traversing.interfaces import ITraversable
+        from zope.traversing.adapters import DefaultTraversable
+        provideAdapter(DefaultTraversable, (Interface,), ITraversable)
+    except ImportError:
+        # Zope < 2.10 - no deed to do anything
+        pass


Property changes on: PluggableAuthService/trunk/tests/utils.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Checkins mailing list