/usr/share/pyshared/zope/app/testing/cookieTestTwo.txt is in python-zope.app.testing 3.10.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ========================
DocTest Functional Tests
========================
This file documents and tests doctest-based functional tests and basic
Zope web-application functionality.
This second DocTest, zope/app/testing/cookieTestTwo.txt, has specifically
been created in order to make sure cookie information is not being saved
across a test suite. If we are saving these via a global 'http' instance,
we will see more results than those listed below. 'http' is instead
created in setUp within _prepare_doctest_keywords, rather than in the
global declarations.
>>> from zope.app.testing import functional
>>> from zope.app.testing.tests import DummyCookiesResponse
>>> response = DummyCookiesResponse(dict(
... cobalt=dict(value='fromCookieTestTwo',
... path='/foo',
... comment='rest is ignored'),
... crimson=dict(value='fromCookieTestTwo')))
>>> http.saveCookies(response)
>>> len(http.cookies)
2
>>> http.cookies['cobalt'].OutputString()
'cobalt=fromCookieTestTwo; Path=/foo...'
>>> http.cookies
<SimpleCookie: cobalt='fromCookieTestTwo' crimson='fromCookieTestTwo'>
>>> http.cookies['cobalt'] = 'fromCookieTestTwo'
>>> http.cookies['cobalt']['path'] = '/foo'
>>> http.cookies['amber'] = 'fromCookieTestTwo'
>>> http.cookies['amber']['path'] = '/foo/baz'
>>> http.cookies['crimson'] = 'fromCookieTestTwo'
>>> cookieHeader = http.httpCookie('/foo/bar')
>>> parts = cookieHeader.split('; ')
>>> parts.sort()
>>> parts
['cobalt=fromCookieTestTwo', 'crimson=fromCookieTestTwo']
>>> cookieHeader = http.httpCookie('/foo/baz')
>>> parts = cookieHeader.split('; ')
>>> parts.sort()
>>> parts
['amber=fromCookieTestTwo',
'cobalt=fromCookieTestTwo',
'crimson=fromCookieTestTwo']
|