~ubuntu-branches/ubuntu/oneiric/zope.app.testing/oneiric

« back to all changes in this revision

Viewing changes to PKG-INFO

  • Committer: Bazaar Package Importer
  • Author(s): Gediminas Paulauskas
  • Date: 2010-12-02 19:58:25 UTC
  • Revision ID: james.westby@ubuntu.com-20101202195825-7y6wai68ygqv95kh
Tags: upstream-3.7.8
ImportĀ upstreamĀ versionĀ 3.7.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Metadata-Version: 1.0
 
2
Name: zope.app.testing
 
3
Version: 3.7.8
 
4
Summary: Zope Application Testing Support
 
5
Home-page: http://pypi.python.org/pypi/zope.app.testing
 
6
Author: Zope Foundation and Contributors
 
7
Author-email: zope-dev@zope.org
 
8
License: ZPL 2.1
 
9
Description: This package provides testing support for Zope 3 applications. Besides
 
10
        providing numerous setup convenience functions, it implements a testing setup
 
11
        that allows the user to make calls to the publisher allowing to write
 
12
        functional tests.
 
13
        
 
14
        
 
15
        .. contents::
 
16
        
 
17
        =================
 
18
        FDocTest (How-To)
 
19
        =================
 
20
        
 
21
        Steps to get started:
 
22
        
 
23
        1. Use a clean/missing Data.fs
 
24
        
 
25
        2. Create a manager with the name "mgr", password "mgrpw", and grant
 
26
        the zope.Manager role.
 
27
        
 
28
        3. Install tcpwatch.
 
29
        
 
30
        4. Create a temporary directory to record tcpwatch output.
 
31
        
 
32
        5. Run tcpwatch using:
 
33
        tcpwatch.py -L 8081:8080 -s -r tmpdir
 
34
        (the ports are the listening port and forwarded-to port; the
 
35
        second need to match the Zope configuration)
 
36
        
 
37
        6. In a browser, connect to the listening port and do whatever needs
 
38
        to be recorded.
 
39
        
 
40
        7. Shut down tcpwatch.
 
41
        
 
42
        8. Run the script src/zope/app/testing/dochttp.py:
 
43
        python2.4 src/zope/app/testing/dochttp.py tmpdir > somefile.txt
 
44
        
 
45
        9. Edit the generated text file to add explanations and elide
 
46
        uninteresting portions of the output.
 
47
        
 
48
        10. In a functional test module (usually ftests.py), import
 
49
        FunctionalDocFileSuite from zope.app.testing.functional and
 
50
        instantiate it, passing the name of the text file containing
 
51
        the test.
 
52
        
 
53
        
 
54
        
 
55
        
 
56
        ========================
 
57
        DocTest Functional Tests
 
58
        ========================
 
59
        
 
60
        This file documents and tests doctest-based functional tests and basic
 
61
        Zope web-application functionality.
 
62
        
 
63
        Request/Response Functional Tests
 
64
        ---------------------------------
 
65
        
 
66
        You can create Functional tests as doctests.  Typically, this is done
 
67
        by using a script such as src/zope/app/testing/dochttp.py to convert
 
68
        tcpwatch recorded output to a doctest, which is then edited to provide
 
69
        explanation and to remove uninteresting details.  That is how this
 
70
        file was created.
 
71
        
 
72
        Here we'll test some of the most basic types of access.
 
73
        
 
74
        First, we'll test accessing a protected page without credentials:
 
75
        
 
76
        >>> print http(r"""
 
77
        ... GET /@@contents.html HTTP/1.1
 
78
        ... """)
 
79
        HTTP/1.1 401 Unauthorized
 
80
        Cache-Control: no-store, no-cache, must-revalidate
 
81
        Content-Length: ...
 
82
        Content-Type: text/html;charset=utf-8
 
83
        Expires: Mon, 26 Jul 1997 05:00:00 GMT
 
84
        Pragma: no-cache
 
85
        WWW-Authenticate: basic realm="Zope"
 
86
        <BLANKLINE>
 
87
        <!DOCTYPE html PUBLIC ...
 
88
        
 
89
        Here we see that we got:
 
90
        
 
91
        - A 401 response,
 
92
        - A WWW-Authenticate header, and
 
93
        - An html body with an error message
 
94
        - Some technical headers to keep squid happy
 
95
        
 
96
        Note that we used ellipsis to indicate ininteresting details.
 
97
        
 
98
        Next, we'll access the same page with credentials:
 
99
        
 
100
        >>> print http(r"""
 
101
        ... GET /@@contents.html HTTP/1.1
 
102
        ... Authorization: Basic mgr:mgrpw
 
103
        ... """)
 
104
        HTTP/1.1 200 OK
 
105
        Content-Length: ...
 
106
        Content-Type: text/html;charset=utf-8
 
107
        <BLANKLINE>
 
108
        <!DOCTYPE html PUBLIC ...
 
109
        
 
110
        Important note: you must use the user named "mgr" with a password
 
111
        "mgrpw".
 
112
        
 
113
        And we get a normal output.
 
114
        
 
115
        Next we'll try accessing site management. Since we used "/manage",
 
116
        we got redirected:
 
117
        
 
118
        >>> print http(r"""
 
119
        ... GET /++etc++site/@@manage HTTP/1.1
 
120
        ... Authorization: Basic mgr:mgrpw
 
121
        ... Referer: http://localhost:8081/
 
122
        ... """)
 
123
        HTTP/1.1 303 See Other
 
124
        Content-Length: 0
 
125
        Content-Type: text/plain;charset=utf-8
 
126
        Location: @@contents.html
 
127
        <BLANKLINE>
 
128
        
 
129
        Note that, in this case, we got a 303 response.  A 303 response is the
 
130
        prefered response for this sort of redirect with HTTP 1.1.  If we used
 
131
        HTTP 1.0, we'd get a 302 response:
 
132
        
 
133
        >>> print http(r"""
 
134
        ... GET /++etc++site/@@manage HTTP/1.0
 
135
        ... Authorization: Basic mgr:mgrpw
 
136
        ... Referer: http://localhost:8081/
 
137
        ... """)
 
138
        HTTP/1.0 302 Moved Temporarily
 
139
        Content-Length: 0
 
140
        Content-Type: text/plain;charset=utf-8
 
141
        Location: @@contents.html
 
142
        <BLANKLINE>
 
143
        
 
144
        Lets visit the page we were redirected to:
 
145
        
 
146
        >>> print http(r"""
 
147
        ... GET /++etc++site/@@contents.html HTTP/1.1
 
148
        ... Authorization: Basic mgr:mgrpw
 
149
        ... Referer: http://localhost:8081/
 
150
        ... """)
 
151
        HTTP/1.1 200 OK
 
152
        Content-Length: ...
 
153
        Content-Type: text/html;charset=utf-8
 
154
        <BLANKLINE>
 
155
        <!DOCTYPE html PUBLIC ...
 
156
        
 
157
        Finally, lets access the default page for the site:
 
158
        
 
159
        >>> print http(r"""
 
160
        ... GET / HTTP/1.1
 
161
        ... Authorization: Basic mgr:mgrpw
 
162
        ... """)
 
163
        HTTP/1.1 200 OK
 
164
        Content-Length: ...
 
165
        Content-Type: text/html;charset=utf-8
 
166
        <BLANKLINE>
 
167
        <!DOCTYPE html PUBLIC ...
 
168
        
 
169
        Access to the object system
 
170
        ---------------------------
 
171
        
 
172
        You can use the `getRootFolder()` function:
 
173
        
 
174
        >>> root = getRootFolder()
 
175
        >>> root
 
176
        <zope.site.folder.Folder object at ...>
 
177
        
 
178
        You can intermix HTTP requests with regular Python calls.  Note,
 
179
        however, that making an `http()` call implied a transaction commit.
 
180
        If you want to throw away changes made in Python code, abort the
 
181
        transaction before the HTTP request.
 
182
        
 
183
        >>> print http(r"""
 
184
        ... POST /@@contents.html HTTP/1.1
 
185
        ... Authorization: Basic mgr:mgrpw
 
186
        ... Content-Length: 73
 
187
        ... Content-Type: application/x-www-form-urlencoded
 
188
        ...
 
189
        ... type_name=BrowserAdd__zope.site.folder.Folder&new_value=f1""",
 
190
        ... handle_errors=False)
 
191
        HTTP/1.1 303 See Other
 
192
        Content-Length: ...
 
193
        Content-Type: text/html;charset=utf-8
 
194
        Location: http://localhost/@@contents.html
 
195
        <BLANKLINE>
 
196
        <!DOCTYPE html ...
 
197
        
 
198
        Now we can see that the new folder was added:
 
199
        
 
200
        >>> list(root.keys())
 
201
        [u'f1']
 
202
        
 
203
        
 
204
        =======
 
205
        CHANGES
 
206
        =======
 
207
        
 
208
        3.7.8 (2010-09-17)
 
209
        ------------------
 
210
        
 
211
        - Removed test dependency on ``zope.app.zptpage``.
 
212
        
 
213
        - Switched test dependency from ``zope.app.securitypolicy`` to
 
214
        ``zope.securitypolicy``.
 
215
        
 
216
        3.7.7 (2010-09-14)
 
217
        ------------------
 
218
        
 
219
        - Rereleasing 3.7.5 as 3.7.7 to fix brown bag release.
 
220
        
 
221
        
 
222
        3.7.6 (2010-09-14)
 
223
        ------------------
 
224
        
 
225
        - Brown bag release: It broke the tests of ``zope.testbrowser``.
 
226
        
 
227
        
 
228
        3.7.5 (2010-04-10)
 
229
        ------------------
 
230
        
 
231
        - Switch doctests to use the stdlib ``doctest`` module, rather than the
 
232
        deprecated ``zope.testing.doctest`` variant.
 
233
        
 
234
        
 
235
        3.7.4 (2010-01-08)
 
236
        ------------------
 
237
        
 
238
        - Import hooks functionality from zope.component after it was moved there from
 
239
        zope.site.
 
240
        
 
241
        - Import ISite from zope.component after it was moved there from
 
242
        zope.location. This lifts the dependency on zope.location.
 
243
        
 
244
        - Fix tests using a newer zope.publisher that requires zope.login.
 
245
        
 
246
        3.7.3 (2009-08-20)
 
247
        ------------------
 
248
        
 
249
        - Fixed tests for python 2.4 as well as python 2.5 and 2.6; the change in
 
250
        version 3.7.1 introduced test regressions in python 2.4.
 
251
        
 
252
        3.7.2 (2009-07-24)
 
253
        ------------------
 
254
        
 
255
        - Adjusted tests after the referenced memory leak problem has been fixed in
 
256
        ``zope.component``.
 
257
        
 
258
        
 
259
        3.7.1 (2009-07-21)
 
260
        ------------------
 
261
        
 
262
        - Fixed failing tests. The code revealed that the tests expected the wrong
 
263
        value.
 
264
        
 
265
        
 
266
        3.7.0 (2009-06-19)
 
267
        ------------------
 
268
        
 
269
        - Depend on new ``zope.processlifetime`` interfaces instead of using
 
270
        BBB imports from ``zope.app.appsetup``.
 
271
        
 
272
        - Removed unused dependency on ``zope.app.component``.
 
273
        
 
274
        
 
275
        3.6.2 (2009-04-26)
 
276
        ------------------
 
277
        
 
278
        - Removed deprecated back35 module and loose the dependency on
 
279
        ``zope.deferredimport``.
 
280
        
 
281
        - Adapt to ``zope.app.authentication`` refactoring. We depend on
 
282
        ``zope.password`` now instead.
 
283
        
 
284
        - Adapt to latest ``zope.app.security`` refactoring. We don't need this
 
285
        package anymore.
 
286
        
 
287
        3.6.1 (2009-03-12)
 
288
        ------------------
 
289
        
 
290
        - Use ISkinnable.providedBy(request) instead of IBrowserRequest as condition
 
291
        for calling setDefaultSkin in HTTPCaller. This at the same time removes
 
292
        dependency to the browser part of zope.publisher.
 
293
        
 
294
        - Adapt to the move of IDefaultViewName from zope.component.interfaces
 
295
        to zope.publisher.interfaces.
 
296
        
 
297
        - Remove the DEPENDENCIES.cfg file for zpkg.
 
298
        
 
299
        3.6.0 (2009-02-01)
 
300
        ------------------
 
301
        
 
302
        - Fix AttributeError in ``zope.app.testing.setup.setUpTestAsModule``
 
303
        (when called without name argument).
 
304
        
 
305
        - Use ``zope.container`` instead of ``zope.app.container``.
 
306
        
 
307
        - Use ``zope.site`` instead of ``zope.app.folder`` and
 
308
        ``zope.app.component`` for some parts.
 
309
        
 
310
        3.5.6 (2008-10-13)
 
311
        ------------------
 
312
        
 
313
        - Change argument variable name in provideAdapter to not conflict with
 
314
        buitin keyword in Python 2.6.
 
315
        
 
316
        3.5.5 (2008-10-10)
 
317
        ------------------
 
318
        
 
319
        - Re-configured functional test setup to create test-specific instances
 
320
        of HTTPCaller to ensure that cookies are not shared by doctests
 
321
        in a test suite.
 
322
        
 
323
        3.5.4 (2008-08-25)
 
324
        ------------------
 
325
        
 
326
        - Clean up some transaction management in the functional test setup.
 
327
        
 
328
        3.5.3 (2008-08-22)
 
329
        ------------------
 
330
        
 
331
        - Fix isolation enforcement for product configuration around individual tests.
 
332
        
 
333
        3.5.2 (2008-08-21)
 
334
        ------------------
 
335
        
 
336
        - Added missing dependency information in setup.py.
 
337
        
 
338
        - Added missing import.
 
339
        
 
340
        - Repair memory leak fix released in 3.4.3 to be more sane in the presence of
 
341
        generations.
 
342
        
 
343
        3.5.1 (2008-08-20)
 
344
        ------------------
 
345
        
 
346
        - Correct Fred's "I'm a doofus" release.
 
347
        
 
348
        3.5.0 (2008-08-20)
 
349
        ------------------
 
350
        
 
351
        - Add support for product-configuration as part of functional layers; this
 
352
        more closely mirrors the configuration order for normal operation.
 
353
        
 
354
        3.4.3 (2008-07-25)
 
355
        ------------------
 
356
        
 
357
        - Fix memory leak in all functional tests.
 
358
        see: https://bugs.launchpad.net/zope3/+bug/251273
 
359
        
 
360
        3.4.2 (2008-02-02)
 
361
        ------------------
 
362
        
 
363
        - Fix of 599 error on conflict error in request
 
364
        see: http://mail.zope.org/pipermail/zope-dev/2008-January/030844.html
 
365
        
 
366
        3.4.1 (2007-10-31)
 
367
        ------------------
 
368
        
 
369
        - Fixed deprecation warning for ``ZopeSecurityPolicy``.
 
370
        
 
371
        3.4.0 (2007-10-27)
 
372
        ------------------
 
373
        
 
374
        - Initial release independent of the main Zope tree.
 
375
        
 
376
Keywords: zope3 test testing setup functional
 
377
Platform: UNKNOWN
 
378
Classifier: Development Status :: 5 - Production/Stable
 
379
Classifier: Environment :: Web Environment
 
380
Classifier: Intended Audience :: Developers
 
381
Classifier: License :: OSI Approved :: Zope Public License
 
382
Classifier: Programming Language :: Python
 
383
Classifier: Natural Language :: English
 
384
Classifier: Operating System :: OS Independent
 
385
Classifier: Topic :: Internet :: WWW/HTTP
 
386
Classifier: Framework :: Zope3