[Checkins] SVN: zope.pluggableauth/trunk/s Getting rid of zope.app.testing

Souheil CHELFOUH souheil at chelfouh.com
Tue Jan 26 11:16:33 EST 2010


Log message for revision 108524:
  Getting rid of zope.app.testing
  

Changed:
  U   zope.pluggableauth/trunk/setup.py
  U   zope.pluggableauth/trunk/src/zope/__init__.py
  U   zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/generic.py
  U   zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/session.py
  U   zope.pluggableauth/trunk/src/zope/pluggableauth/tests.py

-=-
Modified: zope.pluggableauth/trunk/setup.py
===================================================================
--- zope.pluggableauth/trunk/setup.py	2010-01-26 16:11:12 UTC (rev 108523)
+++ zope.pluggableauth/trunk/setup.py	2010-01-26 16:16:33 UTC (rev 108524)
@@ -1,10 +1,28 @@
 ##############################################################################
+#
+# Copyright (c) 2004 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.
+#
+##############################################################################
+
+##############################################################################
 # This package is developed by the Zope Toolkit project, documented here:
 # http://docs.zope.org/zopetoolkit
 # When developing and releasing this package, please follow the documented
 # Zope Toolkit policies as described by this documentation.
 ##############################################################################
+"""Pluggable Authentication Utility
 
+$Id$
+"""
+
 import os
 from setuptools import setup, find_packages
 
@@ -28,7 +46,7 @@
       namespace_packages=['zope'],
       include_package_data = True,
       zip_safe = False,
-      extras_require=dict(test=['zope.app.testing']),
+      extras_require=dict(test=[]),
       install_requires=[
           'ZODB3',
           'setuptools',

Modified: zope.pluggableauth/trunk/src/zope/__init__.py
===================================================================
--- zope.pluggableauth/trunk/src/zope/__init__.py	2010-01-26 16:11:12 UTC (rev 108523)
+++ zope.pluggableauth/trunk/src/zope/__init__.py	2010-01-26 16:16:33 UTC (rev 108524)
@@ -5,4 +5,3 @@
 except ImportError:
     import pkgutil
     __path__ = pkgutil.extend_path(__path__, __name__)
-

Modified: zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/generic.py
===================================================================
--- zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/generic.py	2010-01-26 16:11:12 UTC (rev 108523)
+++ zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/generic.py	2010-01-26 16:16:33 UTC (rev 108524)
@@ -91,4 +91,3 @@
 
     def logout(self, request):
         return False
-

Modified: zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/session.py
===================================================================
--- zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/session.py	2010-01-26 16:11:12 UTC (rev 108523)
+++ zope.pluggableauth/trunk/src/zope/pluggableauth/plugins/session.py	2010-01-26 16:16:33 UTC (rev 108524)
@@ -71,11 +71,14 @@
         self.login = login
         self.password = password
 
-    def getLogin(self): return self.login
+    def getLogin(self):
+        return self.login
 
-    def getPassword(self): return self.password
+    def getPassword(self):
+        return self.password
 
-    def __str__(self): return self.getLogin() + ':' + self.getPassword()
+    def __str__(self):
+        return self.getLogin() + ':' + self.getPassword()
 
 
 class IBrowserFormChallenger(Interface):

Modified: zope.pluggableauth/trunk/src/zope/pluggableauth/tests.py
===================================================================
--- zope.pluggableauth/trunk/src/zope/pluggableauth/tests.py	2010-01-26 16:11:12 UTC (rev 108523)
+++ zope.pluggableauth/trunk/src/zope/pluggableauth/tests.py	2010-01-26 16:16:33 UTC (rev 108524)
@@ -19,15 +19,21 @@
 
 import doctest
 import unittest
-from zope.app.testing import placelesssetup
-from zope.app.testing.setup import placefulSetUp, placefulTearDown
-from zope.component import provideUtility, provideAdapter, provideHandler
+import zope.component
 from zope.component.eventtesting import getEvents, clearEvents
+from zope.component.interfaces import IComponentLookup
+from zope.container.interfaces import ISimpleReadContainer
+from zope.container.traversal import ContainerTraversable
+from zope.interface import Interface
 from zope.interface import implements
 from zope.pluggableauth.plugins.session import SessionCredentialsPlugin
 from zope.publisher import base
 from zope.publisher.interfaces import IRequest
 from zope.session.http import CookieClientIdManager
+from zope.site.folder import rootFolder
+from zope.site.site import LocalSiteManager, SiteManagerAdapter
+from zope.traversing.interfaces import ITraversable
+from zope.traversing.testing import setUp
 from zope.session.interfaces import (
     IClientId, IClientIdManager, ISession, ISessionDataContainer)
 from zope.session.session import (
@@ -42,30 +48,43 @@
 
 
 def siteSetUp(test):
-    placefulSetUp(site=True)
+    zope.component.hooks.setHooks()
 
+    # Set up site manager adapter
+    zope.component.provideAdapter(
+        SiteManagerAdapter, (Interface,), IComponentLookup)
 
+    # Set up traversal
+    setUp()
+    zope.component.provideAdapter(
+        ContainerTraversable, (ISimpleReadContainer,), ITraversable)
+
+    # Set up site
+    site = rootFolder()
+    site.setSiteManager(LocalSiteManager(site))
+    zope.component.hooks.setSite(site)
+
+    return site
+
+
 def siteTearDown(test):
-    placefulTearDown()
+    zope.component.hooks.resetHooks()
+    zope.component.hooks.setSite()
 
 
-def sessionSetUp(session_data_container_class=PersistentSessionDataContainer):
-    placelesssetup.setUp()
-    provideAdapter(TestClientId, [IRequest], IClientId)
-    provideAdapter(Session, [IRequest], ISession)
-    provideUtility(CookieClientIdManager(), IClientIdManager)
-    sdc = session_data_container_class()
-    provideUtility(sdc, ISessionDataContainer, '')
+def sessionSetUp(container=PersistentSessionDataContainer):
+    zope.component.provideAdapter(TestClientId, [IRequest], IClientId)
+    zope.component.provideAdapter(Session, [IRequest], ISession)
+    zope.component.provideUtility(CookieClientIdManager(), IClientIdManager)
+    zope.component.provideUtility(container(), ISessionDataContainer, '')
 
 
-def nonHTTPSessionTestCaseSetUp(sdc_class=PersistentSessionDataContainer):
+def nonHTTPSessionTestCaseSetUp(container=PersistentSessionDataContainer):
     # I am getting an error with ClientId and not TestClientId
-    placelesssetup.setUp()
-    provideAdapter(ClientId, [IRequest], IClientId)
-    provideAdapter(Session, [IRequest], ISession)
-    provideUtility(CookieClientIdManager(), IClientIdManager)
-    sdc = sdc_class()
-    provideUtility(sdc, ISessionDataContainer, '')
+    zope.component.provideAdapter(ClientId, [IRequest], IClientId)
+    zope.component.provideAdapter(Session, [IRequest], ISession)
+    zope.component.provideUtility(CookieClientIdManager(), IClientIdManager)
+    zope.component.provideUtility(container(), ISessionDataContainer, '')
 
 
 class NonHTTPSessionTestCase(unittest.TestCase):
@@ -77,7 +96,8 @@
         nonHTTPSessionTestCaseSetUp()
 
     def tearDown(self):
-        placefulTearDown()
+        zope.component.hooks.resetHooks()
+        zope.component.hooks.setSite()
 
     def test_exeractCredentials(self):
         plugin = SessionCredentialsPlugin()
@@ -102,18 +122,21 @@
         doctest.DocTestSuite('zope.pluggableauth.plugins.generic'),
         doctest.DocTestSuite('zope.pluggableauth.plugins.ftpplugins'),
         doctest.DocTestSuite('zope.pluggableauth.plugins.httpplugins'),
-        doctest.DocTestSuite('zope.pluggableauth.plugins.session',
-                             setUp=siteSetUp,
-                             tearDown=siteTearDown),
-        doctest.DocFileSuite('README.txt',
-                             setUp=siteSetUp,
-                             tearDown=siteTearDown,
-                             globs={'provideUtility': provideUtility,
-                                    'provideAdapter': provideAdapter,
-                                    'provideHandler': provideHandler,
-                                    'getEvents': getEvents,
-                                    'clearEvents': clearEvents,
-                                    })))
+        doctest.DocTestSuite(
+            'zope.pluggableauth.plugins.session',
+            setUp=siteSetUp,
+            tearDown=siteTearDown),
+        doctest.DocFileSuite(
+            'README.txt',
+            setUp=siteSetUp,
+            tearDown=siteTearDown,
+            globs={'provideUtility': zope.component.provideUtility,
+                   'provideAdapter': zope.component.provideAdapter,
+                   'provideHandler': zope.component.provideHandler,
+                   'getEvents': getEvents,
+                   'clearEvents': clearEvents,
+                   }),
+        ))
     return suite
 
 



More information about the checkins mailing list