[Checkins] SVN: zope.app.testing/branches/3.7/ back merge of two fixes from trunk, so ZTK 1.0 does not depend on deprecated packages

Michael Howitz mh at gocept.com
Fri Sep 17 11:47:35 EDT 2010


Log message for revision 116533:
  back merge of two fixes from trunk, so ZTK 1.0 does not depend on deprecated packages
  

Changed:
  U   zope.app.testing/branches/3.7/CHANGES.txt
  U   zope.app.testing/branches/3.7/setup.py
  U   zope.app.testing/branches/3.7/src/zope/app/testing/ftesting.zcml
  U   zope.app.testing/branches/3.7/src/zope/app/testing/tests.py

-=-
Modified: zope.app.testing/branches/3.7/CHANGES.txt
===================================================================
--- zope.app.testing/branches/3.7/CHANGES.txt	2010-09-17 14:44:39 UTC (rev 116532)
+++ zope.app.testing/branches/3.7/CHANGES.txt	2010-09-17 15:47:35 UTC (rev 116533)
@@ -2,6 +2,14 @@
 CHANGES
 =======
 
+3.7.8 (unreleased)
+------------------
+
+- Removed test dependency on ``zope.app.zptpage``.
+
+- Switched test dependency from ``zope.app.securitypolicy`` to
+  ``zope.securitypolicy``.
+
 3.7.7 (2010-09-14)
 ------------------
 
@@ -13,6 +21,7 @@
 
 - Brown bag release: It broke the tests of ``zope.testbrowser``.
 
+
 3.7.5 (2010-04-10)
 ------------------
 

Modified: zope.app.testing/branches/3.7/setup.py
===================================================================
--- zope.app.testing/branches/3.7/setup.py	2010-09-17 14:44:39 UTC (rev 116532)
+++ zope.app.testing/branches/3.7/setup.py	2010-09-17 15:47:35 UTC (rev 116533)
@@ -56,14 +56,14 @@
       packages=find_packages('src'),
       package_dir = {'': 'src'},
       namespace_packages=['zope', 'zope.app'],
-      extras_require=dict(test=['zope.app.authentication',
-                                'zope.app.zptpage',
-                                'zope.app.securitypolicy',
-                                'zope.app.zcmlfiles',
-                                'ZODB3',
-                                'zope.publisher >= 3.12',
-                                'zope.login',
-                                ]),
+      extras_require=dict(test=[
+          'ZODB3',
+          'zope.app.authentication',
+          'zope.app.zcmlfiles',
+          'zope.login',
+          'zope.publisher >= 3.12',
+          'zope.securitypolicy',
+          ]),
       install_requires=['setuptools',
                         'zope.annotation',
                         'zope.app.appsetup >=3.11.0',

Modified: zope.app.testing/branches/3.7/src/zope/app/testing/ftesting.zcml
===================================================================
--- zope.app.testing/branches/3.7/src/zope/app/testing/ftesting.zcml	2010-09-17 14:44:39 UTC (rev 116532)
+++ zope.app.testing/branches/3.7/src/zope/app/testing/ftesting.zcml	2010-09-17 15:47:35 UTC (rev 116533)
@@ -11,10 +11,7 @@
   <include package="zope.app.zcmlfiles" />
 
   <include package="zope.app.authentication" />
-  <include package="zope.app.zptpage"/>
-
-  <include package="zope.app.securitypolicy.browser.tests" file="functional.zcml" />
-  <include package="zope.app.securitypolicy" />
+  <include package="zope.securitypolicy" />
   <include package="zope.login" />
 
   <securityPolicy
@@ -44,15 +41,8 @@
       login="mgr"
       password="mgrpw" />
 
-  <!-- Bootstrap principal used to make local grant to the principal above -->
-  <principal
-      id="zope.globalmgr"
-      title="Manager"
-      login="globalmgr"
-      password="globalmgrpw" />
+  <grant role="zope.Manager" principal="zope.mgr" />
 
-  <grant role="zope.Manager" principal="zope.globalmgr" />
-
   <adapter
            factory="zope.app.testing.testing.ConflictRaisingView"
            name="test-conflict-raise-view.html" />

Modified: zope.app.testing/branches/3.7/src/zope/app/testing/tests.py
===================================================================
--- zope.app.testing/branches/3.7/src/zope/app/testing/tests.py	2010-09-17 14:44:39 UTC (rev 116532)
+++ zope.app.testing/branches/3.7/src/zope/app/testing/tests.py	2010-09-17 15:47:35 UTC (rev 116533)
@@ -246,6 +246,23 @@
     # standard library has tests for (we hope).
 
 
+class GetCookies(object):
+    """Get all cookies set."""
+
+    def __call__(self):
+        cookies = ['%s=%s'%(k, v)
+                   for k, v in self.request.getCookies().items()]
+        cookies.sort()
+        return ';'.join(cookies)
+
+
+class SetCookies(object):
+    """Set a specific cookie."""
+
+    def __call__(self):
+        self.request.response.setCookie('bid', 'bval')
+
+
 class CookieFunctionalTest(BrowserTestCase):
 
     """Functional tests should handle cookies like a web browser
@@ -259,42 +276,34 @@
     """
 
     def setUp(self):
+        import zope.configuration.xmlconfig
+
         super(CookieFunctionalTest, self).setUp()
         self.assertEqual(
                 len(self.cookies.keys()), 0,
                 'cookies store should be empty'
                 )
 
-        root = self.getRootFolder()
+        zope.configuration.xmlconfig.string(r'''
+        <configure xmlns="http://namespaces.zope.org/browser">
 
-        from zope.app.zptpage.zptpage import ZPTPage
+           <include package="zope.browserpage" file="meta.zcml" />
 
-        page = ZPTPage()
+           <page
+              name="getcookies"
+              for="*"
+              permission="zope.Public"
+              class="zope.app.testing.tests.GetCookies" />
 
-        page.source = u'''<tal:tag tal:define="
-        cookies python:['%s=%s'%(k,v) for k,v in request.getCookies().items()]"
-        ><tal:tag tal:define="
-        ignored python:cookies.sort()"
-        /><span tal:replace="python:';'.join(cookies)" /></tal:tag>'''
+           <page
+              name="setcookie"
+              for="*"
+              permission="zope.Public"
+              class="zope.app.testing.tests.SetCookies" />
 
-        root['getcookies'] = page
+        </configure>
+        ''')
 
-        page = ZPTPage()
-
-        page.source = u'''<tal:tag tal:define="
-            ignored python:request.response.setCookie('bid','bval')" >
-            <h1 tal:condition="ignored" />
-            </tal:tag>'''
-
-        root['setcookie'] = page
-        transaction.commit()
-
-    def tearDown(self):
-        root = self.getRootFolder()
-        del root['getcookies']
-        del root['setcookie']
-        super(CookieFunctionalTest, self).tearDown()
-
     def testDefaultCookies(self):
         # By default no cookies are set
         response = self.publish('/')



More information about the checkins mailing list