[Checkins] SVN: Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/ fix tests by registering the DefaultTraversable adapter. these tests were only working in Zope 2.10 by virtue of happening to run after other tests that registered the adapter

David Glick davidglick at onenw.org
Wed Jul 22 03:22:50 EDT 2009


Log message for revision 102059:
  fix tests by registering the DefaultTraversable adapter. these tests were only working in Zope 2.10 by virtue of happening to run after other tests that registered the adapter

Changed:
  U   Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/doc/CHANGES.txt
  U   Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/tests/test_exportimport.py

-=-
Modified: Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/doc/CHANGES.txt
===================================================================
--- Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/doc/CHANGES.txt	2009-07-21 16:33:49 UTC (rev 102058)
+++ Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/doc/CHANGES.txt	2009-07-22 07:22:49 UTC (rev 102059)
@@ -4,6 +4,9 @@
 PluggableAuthService 1.6.2 (unreleased)
 ---------------------------------------
 
+- Fixed test setup for tests using page templates relying on the
+  DefaultTraversable adapter.
+
 - Fixed broken markup.
 
 PluggableAuthService 1.6.1 (2008-11-20)

Modified: Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/tests/test_exportimport.py
===================================================================
--- Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/tests/test_exportimport.py	2009-07-21 16:33:49 UTC (rev 102058)
+++ Products.PluggableAuthService/branches/1.6/Products/PluggableAuthService/plugins/tests/test_exportimport.py	2009-07-22 07:22:49 UTC (rev 102059)
@@ -37,6 +37,8 @@
     from Products.GenericSetup.tests.common import BaseRegistryTests
     from Products.GenericSetup.tests.common import DummyExportContext
     from Products.GenericSetup.tests.common import DummyImportContext
+    
+    from Products.PluggableAuthService.tests.utils import _setUpDefaultTraversable
 
     class _TestBase(BaseRegistryTests,
                     ConformsToIFilesystemExporter,
@@ -74,6 +76,8 @@
             self.assertEqual(len(info['users']), 0)
 
         def test_export_empty(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('empty').__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -111,7 +115,8 @@
                 self.assertEqual(x['password_hash'], y['password_hash'])
 
         def test_export_with_users(self):
-
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('with_users').__of__(self.root)
             plugin.title = 'Plugin Title'
 
@@ -215,6 +220,8 @@
             self.assertEqual(len(info['groups']), 0)
 
         def test_export_empty(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('empty').__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -247,7 +254,8 @@
                 self.assertEqual(x, y)
 
         def test_export_with_groups(self):
-
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('with_groups').__of__(self.root)
             plugin.title = 'Plugin Title'
 
@@ -357,6 +365,8 @@
             self.assertEqual(len(info['roles']), 0)
 
         def test_export_empty(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('empty').__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -389,7 +399,8 @@
                 self.assertEqual(x, y)
 
         def test_export_with_roles(self):
-
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('with_roles').__of__(self.root)
             plugin.title = 'Plugin Title'
 
@@ -503,6 +514,8 @@
             self.assertEqual(info['login_path'], CookieAuthHelper.login_path)
 
         def test_export_default(self):
+            _setUpDefaultTraversable()
+            
             from Products.PluggableAuthService.plugins.CookieAuthHelper \
                 import CookieAuthHelper as CAH
             plugin = self._makePlugin('default').__of__(self.root)
@@ -536,6 +549,8 @@
             self.assertEqual(info['login_path'], LOGIN_PATH)
 
         def test_export_explicitly_set(self):
+            _setUpDefaultTraversable()
+            
             TITLE = 'Plugin Title'
             COOKIE_NAME = 'COOKIE_NAME'
             LOGIN_PATH = 'LOGIN_PATH'
@@ -633,6 +648,8 @@
             self.assertEqual(len(info['map']), 0)
 
         def test_export_empty(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('empty', None).__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -673,6 +690,8 @@
             self.assertEqual(match['roles'], ','.join(ROLES))
 
         def test_export_with_map(self):
+            _setUpDefaultTraversable()
+            
             TITLE = 'With Map'
             USER_ID = 'some_user_id'
             DOMAIN = 'host.example.com'
@@ -833,6 +852,8 @@
             self.assertEqual(info['title'], 'Plugin Title')
 
         def test_export_no_title(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('no_title', None).__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -846,6 +867,8 @@
             self.assertEqual( content_type, 'text/xml' )
 
         def test_export_with_title(self):
+            _setUpDefaultTraversable()
+            
             TITLE = 'Plugin Title'
             plugin = self._makePlugin('with_title', None).__of__(self.root)
             plugin.title = TITLE
@@ -924,6 +947,8 @@
             self.assertEqual(info['delegate'], '')
 
         def test_export_default(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('default').__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -949,6 +974,8 @@
             self.assertEqual(info['delegate'], DELEGATE_PATH)
 
         def test_export_explicitly_set(self):
+            _setUpDefaultTraversable()
+            
             TITLE = 'Plugin Title'
             DELEGATE_PATH = 'path/to/delegate'
             plugin = self._makePlugin('explicit').__of__(self.root)
@@ -1030,6 +1057,8 @@
             self.assertEqual(len(info['groups']), 0)
 
         def test_export_empty(self):
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('empty', None).__of__(self.root)
             adapter = self._makeOne(plugin)
 
@@ -1065,7 +1094,8 @@
                 self.assertEqual(x, y)
 
         def test_export_with_groups(self):
-
+            _setUpDefaultTraversable()
+            
             plugin = self._makePlugin('with_groups').__of__(self.root)
             plugin.title = 'Plugin Title'
 



More information about the Checkins mailing list