[Checkins] SVN: z3c.rest/trunk/ - Added not declared test dependencies.
Michael Howitz
mh at gocept.com
Tue Oct 5 02:44:05 EDT 2010
Log message for revision 117227:
- Added not declared test dependencies.
- Updated test set up and fixed tests to run with ZTK 1.0.
- Using Python's ``doctest`` module instead of depreacted
``zope.testing.doctest``.
Changed:
U z3c.rest/trunk/CHANGES.txt
U z3c.rest/trunk/setup.py
U z3c.rest/trunk/src/z3c/rest/application.zcml
U z3c.rest/trunk/src/z3c/rest/client.txt
U z3c.rest/trunk/src/z3c/rest/rest.py
U z3c.rest/trunk/src/z3c/rest/rest.txt
U z3c.rest/trunk/src/z3c/rest/tests/test.py
-=-
Modified: z3c.rest/trunk/CHANGES.txt
===================================================================
--- z3c.rest/trunk/CHANGES.txt 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/CHANGES.txt 2010-10-05 06:44:05 UTC (rev 117227)
@@ -2,6 +2,17 @@
CHANGES
=======
+0.2.6 (unreleased)
+------------------
+
+- Added not declared test dependencies.
+
+- Updated test set up and fixed tests to run with ZTK 1.0.
+
+- Using Python's ``doctest`` module instead of depreacted
+ ``zope.testing.doctest``.
+
+
0.2.5 (2008-09-16)
------------------
Modified: z3c.rest/trunk/setup.py
===================================================================
--- z3c.rest/trunk/setup.py 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/setup.py 2010-10-05 06:44:05 UTC (rev 117227)
@@ -77,9 +77,12 @@
'zope.app.zcmlfiles',
'zope.contentprovider',
],
- test = ['z3c.coverage',
- 'z3c.etestbrowser',
- 'zope.app.testing'],
+ test = [
+ 'z3c.coverage',
+ 'z3c.etestbrowser',
+ 'zope.app.container',
+ 'zope.app.testing',
+ ],
),
install_requires = [
'lxml>=2.0.0', # Changes in API, since 1.3.6.
Modified: z3c.rest/trunk/src/z3c/rest/application.zcml
===================================================================
--- z3c.rest/trunk/src/z3c/rest/application.zcml 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/src/z3c/rest/application.zcml 2010-10-05 06:44:05 UTC (rev 117227)
@@ -4,14 +4,14 @@
i18n_domain="rest">
<include package="zope.app.component" file="meta.zcml" />
- <include package="zope.app.component.browser" file="meta.zcml" />
+ <!-- <include package="zope.app.component.browser" file="meta.zcml" /> -->
<include package="zope.app.container.browser" file="meta.zcml" />
<include package="zope.app.form.browser" file="meta.zcml" />
<include package="zope.app.pagetemplate" file="meta.zcml" />
<include package="zope.app.publication" file="meta.zcml" />
<include package="zope.app.publisher" file="meta.zcml" />
<include package="zope.app.security" file="meta.zcml" />
- <include package="zope.app.securitypolicy" file="meta.zcml" />
+ <include package="zope.securitypolicy" file="meta.zcml" />
<browser:menu id="zmi_views" title="Views" />
<browser:menu id="zmi_actions" title="Actions" />
@@ -27,8 +27,8 @@
<include package="zope.app.pagetemplate" />
<include package="zope.app.publication" />
<include package="zope.app.security" />
- <include package="zope.app.securitypolicy" />
- <include package="zope.app.session" />
+ <!-- <include package="zope.app.securitypolicy" /> -->
+ <!-- <include package="zope.app.session" /> -->
<include package="zope.app.twisted" />
<include package="zope.app.wsgi" />
<include package="zope.annotation" />
@@ -39,6 +39,7 @@
<include package="zope.publisher" />
<include package="zope.traversing" />
<include package="zope.traversing.browser" />
+ <include package="zope.login" />
<include file="configure.zcml" />
@@ -50,7 +51,7 @@
<role id="zope.Anonymous" title="Everybody" />
<grant permission="zope.View"
role="zope.Anonymous" />
- <grant permission="zope.app.dublincore.view"
+ <grant permission="zope.dublincore.view"
role="zope.Anonymous" />
<role id="zope.Manager" title="Site Manager" />
Modified: z3c.rest/trunk/src/z3c/rest/client.txt
===================================================================
--- z3c.rest/trunk/src/z3c/rest/client.txt 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/src/z3c/rest/client.txt 2010-10-05 06:44:05 UTC (rev 117227)
@@ -106,7 +106,7 @@
>>> client.get('http://localhost/unknown')
Traceback (most recent call last):
...
- NotFound: Object: <zope.app.folder.folder.Folder ...>, name: u'unknown'
+ NotFound: Object: <zope.site.folder.Folder ...>, name: u'unknown'
>>> client.handleErrors = True
@@ -179,10 +179,10 @@
>>> realClient.open('http://localhost:65000')
Traceback (most recent call last):
...
- error: (111, 'Connection refused')
+ error: (61, 'Connection refused')
>>> realClient.fullStatus
- '111 Connection refused'
+ '61 Connection refused'
Creating new resources
Modified: z3c.rest/trunk/src/z3c/rest/rest.py
===================================================================
--- z3c.rest/trunk/src/z3c/rest/rest.py 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/src/z3c/rest/rest.py 2010-10-05 06:44:05 UTC (rev 117227)
@@ -75,11 +75,11 @@
errorTemplate = PageTemplateFile("baseerror.pt")
- def handleException(self, exc_info):
+ def handleException(self, exc_info, trusted=False):
errorClass, error = exc_info[:2]
if isinstance(errorClass, (types.ClassType, type)):
if issubclass(errorClass, Redirect):
- self.redirect(error.getLocation())
+ self.redirect(error.getLocation(), trusted=trusted)
return
title = tname = errorClass.__name__
else:
Modified: z3c.rest/trunk/src/z3c/rest/rest.txt
===================================================================
--- z3c.rest/trunk/src/z3c/rest/rest.txt 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/src/z3c/rest/rest.txt 2010-10-05 06:44:05 UTC (rev 117227)
@@ -136,7 +136,8 @@
>>> pprint(request.parameters)
{'action': 'delete',
'format': 'html',
- 'item': ['1', '3']}
+ 'item': ['1',
+ '3']}
We also override some of the request's mapping methods, so that the parameters
and environment values are available as part of the request:
@@ -200,7 +201,8 @@
>>> response._request = rest.RESTRequest(None, {})
>>> from zope.publisher.interfaces import Redirect
- >>> response.handleException((Redirect, Redirect('http://localhost'), None))
+ >>> response.handleException(
+ ... (Redirect, Redirect('http://localhost'), None), trusted=True)
>>> response._status
302
>>> response._reason
Modified: z3c.rest/trunk/src/z3c/rest/tests/test.py
===================================================================
--- z3c.rest/trunk/src/z3c/rest/tests/test.py 2010-10-05 06:19:55 UTC (rev 117226)
+++ z3c.rest/trunk/src/z3c/rest/tests/test.py 2010-10-05 06:44:05 UTC (rev 117227)
@@ -11,29 +11,36 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""REST Tests
+"""REST Tests"""
-$Id$
-"""
-__docformat__ = "reStructuredText"
+from z3c.rest import interfaces
+from zope.app.testing import functional, placelesssetup
+from zope.testing import renormalizing
+from zope.traversing.browser import absoluteurl
+from zope.traversing.interfaces import IContainmentRoot
+import doctest
import os
+import pprint
+import re
import unittest
import zope.component
import zope.traversing.testing
-from zope.testing import doctest, doctestunit
-from zope.traversing.browser import absoluteurl
-from zope.traversing.interfaces import IContainmentRoot
-from zope.app.testing import functional, placelesssetup
-from z3c.rest import interfaces
+
RESTLayer = functional.ZCMLLayer(
os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
__name__, 'RESTLayer', allow_teardown=True)
+
+def compatible_pprint(dict):
+ """Compatible output for Python 2.4 till 2.6."""
+ return pprint.pprint(dict, width=1)
+
+
def setUp(test):
placelesssetup.setUp(test)
zope.traversing.testing.setUp()
-
+
# XXX: This really needs a REST equivalent w/o breadcrumbs.
zope.component.provideAdapter(
@@ -60,13 +67,18 @@
def test_suite():
- client = functional.FunctionalDocFileSuite('../client.txt')
+ client = functional.FunctionalDocFileSuite(
+ '../client.txt',
+ checker=renormalizing.RENormalizing([
+ (re.compile('\[Errno 61\] Connection refused'),
+ "(61, 'Connection refused')")
+ ]))
client.layer = RESTLayer
return unittest.TestSuite((
client,
doctest.DocFileSuite(
'../rest.txt',
- globs={'pprint': doctestunit.pprint},
+ globs={'pprint': compatible_pprint},
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
),
doctest.DocFileSuite(
More information about the checkins
mailing list