Commit bfa3d408 authored by Stefan H. Holek's avatar Stefan H. Holek

Sync changes from CVS HEAD.

parent 9ca50397
......@@ -110,7 +110,7 @@ if not Zope2._began_startup:
_apply_patches()
# Allow test authors to install Zope products into the test environment. Note
# that installProduct() must be called at module level - never from tests.
# that installProduct() must be called at module level -- never from tests.
from OFS.Application import get_folder_permissions, get_products, install_product
from OFS.Folder import Folder
import Products
......@@ -140,7 +140,7 @@ def installProduct(name, quiet=0):
if not quiet: _print('done (%.3fs)\n' % (time.time() - start))
break
else:
if name != 'SomeProduct': # Ignore skeleton tests :-P
if name != 'SomeProduct': # Ignore the skeleton tests :-P
if not quiet: _print('Installing %s ... NOT FOUND\n' % name)
def _load_control_panel():
......@@ -172,7 +172,7 @@ DB = Zope2.DB
configure = Zope2.configure
def startup(): pass
# Provide a ZODB sandbox factory
# ZODB sandbox factory
from ZODB.DemoStorage import DemoStorage
def sandbox(base=None):
......
......@@ -33,6 +33,8 @@ from functional import Functional
from ZODB.tests.warnhook import WarningsHook
from unittest import main
from ztc_doctest import ZopeDocFileSuite
from ztc_doctest import FunctionalDocFileSuite
from zopedoctest import ZopeDocTestSuite
from zopedoctest import ZopeDocFileSuite
from zopedoctest import FunctionalDocTestSuite
from zopedoctest import FunctionalDocFileSuite
......@@ -171,8 +171,8 @@ Class ZopeTestCase
Class FunctionalTestCase
Convenience class for functional unit tests
(derived from ZopeTestCase)
Convenience class for functional unit testing
(derived from Functional and ZopeTestCase)
__implements__ = (Functional.__implements__,
ZopeTestCase.__implements__)
......
0.9.7 (Zope 2.8 edition)
- Renamed 'doctest' sub-package to 'ztc_doctest' because of name-shadowing
issues uncovered during integration into Zope 2.8. This should not
affect existing tests as user code is not expected to import from sub-
packages anyway.
- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
issues discovered during integration into Zope 2.8.
- Greatly improved the doctest story. ZopeTestCase now implements four test
suite factories: ZopeDocTestSuite, ZopeDocFileSuite, FunctionalDocTestSuite,
and FunctionalDocFileSuite.
- Removed warnhook.py, we now use the one from ZODB.tests.
- Removed doctest.py, we now use the one from zope.testing.
- Removed dochttp.py + test, we now use the one from zope.app.tests.
- ZopeLite now takes care not to monkey patch an already running Zope.
- ZopeLite now takes care not to monkey patch an already started Zope.
0.9.6
- Dropped support for Zope 2.5 as it lacks the setSecurityManager() API.
......
......@@ -60,15 +60,13 @@ and turn them into tests:
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
from unittest import TestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
def test_suite():
suite = TestSuite()
suite.addTest(FunctionalDocFileSuite('FunctionalDocTest.txt'))
return suite
return TestSuite((
FunctionalDocFileSuite('FunctionalDocTest.txt'),
))
if __name__ == '__main__':
framework()
......
Doctest support for ZopeTestCase
================================
Doc test support for ZopeTestCase
=================================
Backport of functional doc tests from Zope 3 by
Sidnei da Silva. See 'FunctionalDocTest.txt' for
......
Dummy Test
==========
This dummy test is just used to check that passing in a ``test_class``
This dummy test is used to verify that passing in a ``test_class``
that doesn't subclass ``ZopeTestCase.Functional`` still works but
issues a warning.
>>> from Testing import ZopeTestCase
>>> class NoFunctionalTest(ZopeTestCase.ZopeTestCase): pass
>>> hook = ZopeTestCase.WarningsHook()
>>> from Testing import ZopeTestCase as zopetest
>>> hook = zopetest.WarningsHook()
>>> hook.install()
>>> test = ZopeTestCase.FunctionalDocFileSuite('WarningsTest.txt',
... package='Testing.ZopeTestCase.ztc_doctest',
... test_class=NoFunctionalTest)
>>> suite = zopetest.FunctionalDocFileSuite('WarningsTest.txt',
... package=zopetest.zopedoctest,
... test_class=zopetest.ZopeTestCase)
>>> len(hook.warnings)
1
>>> message, category, filename, lineno = hook.warnings[0]
>>> message
"The test_class you are using doesn't subclass from ZopeTestCase.Functional. Please fix that."
......
......@@ -30,15 +30,13 @@ infrastructure to set up the necessary environment.
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
def test_suite():
suite = TestSuite()
suite.addTest(ZopeDocFileSuite('ZopeDocTest.txt'))
return suite
return TestSuite((
ZopeDocFileSuite('ZopeDocTest.txt'),
))
if __name__ == '__main__':
framework()
......
#
# ZopeTestCase doctest support
#
# $Id: __init__.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
__version__ = '0.9.7'
from zope.testing.doctest import *
from functional import *
......@@ -2,20 +2,20 @@
# Support for functional doc tests
#
# $Id: functional.py,v 1.7 2005/02/04 21:32:33 shh42 Exp $
# $Id: functional.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
import sys
import re
import base64
import sys, re, base64
import warnings
from zope.testing import doctest
from Testing.ZopeTestCase import Functional
from Testing.ZopeTestCase import FunctionalTestCase
from Testing.ZopeTestCase import ZopeTestCase
from Testing.ZopeTestCase import FunctionalTestCase
from Testing.ZopeTestCase import Functional
from Testing.ZopeTestCase import user_name
from Testing.ZopeTestCase import user_password
from Testing.ZopeTestCase import user_role
from Testing.ZopeTestCase import standard_permissions
from Testing.ZopeTestCase.sandbox import AppZapper
from Testing.ZopeTestCase.functional import ResponseWrapper
......@@ -57,7 +57,7 @@ class HTTPHeaderOutput:
class DocResponseWrapper(ResponseWrapper):
"""Response Wrapper for use in doc tests
"""Response Wrapper for use in doctests
"""
def __init__(self, response, outstream, path, header_output):
......@@ -168,7 +168,7 @@ def http(request_string, handle_errors=True):
header_output.setResponseHeaders(response.headers)
# Restore previous security manager, which may have been changed
# by calling the publish method above.
# by calling the publish method above
setSecurityManager(old_sm)
# Sync connection
......@@ -177,82 +177,150 @@ def http(request_string, handle_errors=True):
return DocResponseWrapper(response, outstream, path, header_output)
def FunctionalDocFileSuite(*paths, **kw):
globs = kw.setdefault('globs', {})
globs['http'] = http
globs['getRootFolder'] = getRootFolder
globs['sync'] = sync
globs['user_auth'] = base64.encodestring('%s:%s' % (user_name, user_password))
test_class = kw.get('test_class', FunctionalTestCase)
# Must call here or it may guess the package wrongly
kw['package'] = doctest._normalize_module(kw.get('package'))
# If the passed-in test_class doesn't subclass Functional,
# we mix it in for you, but we will issue a warning.
if not issubclass(test_class, Functional):
name = test_class.__name__
warnings.warn(("The test_class you are using doesn't "
"subclass from ZopeTestCase.Functional. "
"Please fix that."), UserWarning, 2)
if not 'Functional' in name:
name = 'Functional%s' % name
test_class = type(name, (Functional, test_class), {})
kw['test_class'] = test_class
return ZopeDocFileSuite(*paths, **kw)
class ZopeSuiteFactory:
def __init__(self, *args, **kw):
self._args = args
self._kw = kw
self.run()
def doctestsuite(self):
return doctest.DocTestSuite(*self._args, **self._kw)
def docfilesuite(self):
return doctest.DocFileSuite(*self._args, **self._kw)
def run(self):
self.setup_globs()
self.setup_test_class()
self.setup_optionflags()
def setup_globs(self):
globs = self._kw.setdefault('globs', {})
globs['user_name'] = user_name
globs['user_password'] = user_password
globs['user_role'] = user_role
globs['standard_permissions'] = standard_permissions
def setup_test_class(self):
test_class = self._kw.get('test_class', ZopeTestCase)
if 'test_class' in self._kw:
del self._kw['test_class']
# If the test_class does not have a runTest method, we add
# a dummy attribute so that TestCase construction works.
if not hasattr(test_class, 'runTest'):
setattr(test_class, 'runTest', None)
# Create a TestCase instance which will be used to
# execute the setUp and tearDown methods, as well as
# be passed into the test globals as 'self'.
test_instance = test_class()
kwsetUp = self._kw.get('setUp')
def setUp(test):
test_instance.setUp()
test.globs['test'] = test
test.globs['self'] = test_instance
test.globs['app'] = test_instance.app
if hasattr(test_instance, 'folder'):
test.globs['folder'] = test_instance.folder
test.globs['folder_name'] = test_instance.folder.getId()
if hasattr(test_instance, 'portal'):
test.globs['portal'] = test_instance.portal
test.globs['portal_name'] = test_instance.portal.getId()
if kwsetUp is not None:
kwsetUp(test_instance)
self._kw['setUp'] = setUp
kwtearDown = self._kw.get('tearDown')
def tearDown(test):
if kwtearDown is not None:
kwtearDown(test_instance)
test_instance.tearDown()
self._kw['tearDown'] = tearDown
def setup_optionflags(self):
if 'optionflags' not in self._kw:
self._kw['optionflags'] = (doctest.ELLIPSIS
| doctest.NORMALIZE_WHITESPACE)
class FunctionalSuiteFactory(ZopeSuiteFactory):
def setup_globs(self):
ZopeSuiteFactory.setup_globs(self)
globs = self._kw.setdefault('globs', {})
globs['http'] = http
globs['getRootFolder'] = getRootFolder
globs['sync'] = sync
globs['user_auth'] = base64.encodestring('%s:%s' % (user_name, user_password))
def setup_test_class(self):
test_class = self._kw.get('test_class', FunctionalTestCase)
# If the passed-in test_class doesn't subclass Functional,
# we mix it in for you, but we will issue a warning.
if not issubclass(test_class, Functional):
name = test_class.__name__
warnings.warn(("The test_class you are using doesn't "
"subclass from ZopeTestCase.Functional. "
"Please fix that."), UserWarning, 2)
if not 'Functional' in name:
name = 'Functional%s' % name
test_class = type(name, (Functional, test_class), {})
self._kw['test_class'] = test_class
ZopeSuiteFactory.setup_test_class(self)
def setup_optionflags(self):
if 'optionflags' not in self._kw:
self._kw['optionflags'] = (doctest.ELLIPSIS
| doctest.REPORT_NDIFF
| doctest.NORMALIZE_WHITESPACE)
def ZopeDocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **kw):
if globs is not None:
kw['globs'] = globs
if extraglobs is not None:
kw['extraglobs'] = extraglobs
if test_finder is not None:
kw['test_finder'] = test_finder
module = doctest._normalize_module(module)
return ZopeSuiteFactory(module, **kw).doctestsuite()
def ZopeDocFileSuite(*paths, **kw):
globs = kw.setdefault('globs', {})
test_class = kw.get('test_class', ZopeTestCase)
if kw.get('module_relative', True):
kw['package'] = doctest._normalize_module(kw.get('package'))
return ZopeSuiteFactory(*paths, **kw).docfilesuite()
# If the test_class does not have a runTest method, we add
# a dummy attribute so that TestCase construction works.
if not hasattr(test_class, 'runTest'):
setattr(test_class, 'runTest', None)
# Create a TestCase instance which will be used to
# execute the setUp and tearDown methods, as well as
# be passed into the test globals as 'self'.
test_instance = test_class()
def FunctionalDocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **kw):
if globs is not None:
kw['globs'] = globs
if extraglobs is not None:
kw['extraglobs'] = extraglobs
if test_finder is not None:
kw['test_finder'] = test_finder
module = doctest._normalize_module(module)
return FunctionalSuiteFactory(module, **kw).doctestsuite()
if 'test_class' in kw:
del kw['test_class']
# Must call here or it may guess the package wrongly
kw['package'] = doctest._normalize_module(kw.get('package'))
kwsetUp = kw.get('setUp')
def setUp(test):
test.globs['test'] = test
test.globs['self'] = test_instance
test_instance.setUp()
if kwsetUp is not None:
kwsetUp(test_instance)
kw['setUp'] = setUp
kwtearDown = kw.get('tearDown')
def tearDown(test):
if kwtearDown is not None:
kwtearDown(test_instance)
test_instance.tearDown()
kw['tearDown'] = tearDown
if 'optionflags' not in kw:
kw['optionflags'] = (doctest.ELLIPSIS
| doctest.REPORT_NDIFF
| doctest.NORMALIZE_WHITESPACE)
return doctest.DocFileSuite(*paths, **kw)
def FunctionalDocFileSuite(*paths, **kw):
if kw.get('module_relative', True):
kw['package'] = doctest._normalize_module(kw.get('package'))
return FunctionalSuiteFactory(*paths, **kw).docfilesuite()
__all__ = [
'FunctionalDocFileSuite',
'ZopeDocTestSuite',
'ZopeDocFileSuite',
'FunctionalDocTestSuite',
'FunctionalDocFileSuite',
]
GET /@@contents.html HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
GET /@@contents.html HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic bWdyOm1ncnB3
GET /@@/pl.gif HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/@@contents.html
If-Modified-Since: Thu, 19 Aug 2004 10:10:04 GMT
Authorization: Basic bWdyOm1ncnB3
GET /@@singleBranchTree.xml HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic bWdyOm1ncnB3
GET /@@/mi.gif HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/
Authorization: Basic bWdyOm1ncnB3
GET /++etc++site/@@manage HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/
Authorization: Basic bWdyOm1ncnB3
GET /@@/site_management.css HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/++etc++site/@@tasks.html
Authorization: Basic bWdyOm1ncnB3
GET /@@/zope3.css HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/@@contents.html
If-Modified-Since: Thu, 19 Aug 2004 10:10:06 GMT
Authorization: Basic bWdyOm1ncnB3
GET /@@/onlinehelp.js HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/@@contents.html
If-Modified-Since: Thu, 19 Aug 2004 10:10:06 GMT
Authorization: Basic bWdyOm1ncnB3
GET /@@/xmltree.js HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/@@contents.html
If-Modified-Since: Thu, 19 Aug 2004 10:10:06 GMT
Authorization: Basic bWdyOm1ncnB3
GET /@@/favicon.png HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Thu, 19 Aug 2004 10:10:06 GMT
Authorization: Basic bWdyOm1ncnB3
GET /@@/zope3logo.gif HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/@@contents.html
If-Modified-Since: Thu, 19 Aug 2004 10:10:04 GMT
Authorization: Basic bWdyOm1ncnB3
GET /@@singleBranchTree.xml HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic bWdyOm1ncnB3
GET /@@/zope-app-folder-interfaces-IFolder-zmi_icon.gif HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/@@contents.html
If-Modified-Since: Thu, 19 Aug 2004 10:10:08 GMT
Authorization: Basic bWdyOm1ncnB3
GET / HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic bWdyOm1ncnB3
GET /@@children.xml HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic bWdyOm1ncnB3
GET /@@/zope-app-site-interfaces-ISiteManager-zmi_icon.gif HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/
Authorization: Basic bWdyOm1ncnB3
GET /++etc++site/@@tasks.html HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8081/
Authorization: Basic bWdyOm1ncnB3
GET /++etc++site/@@singleBranchTree.xml HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic bWdyOm1ncnB3
......@@ -2,31 +2,31 @@
# Test for auth_header
#
# $Id: testAuthHeaderTest.py,v 1.2 2005/01/30 14:30:12 shh42 Exp $
# $Id: testAuthHeaderTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
from Testing.ZopeTestCase.ztc_doctest import functional
from unittest import TestSuite, makeSuite
from Testing.ZopeTestCase import TestCase
from Testing.ZopeTestCase import zopedoctest
auth_header = zopedoctest.functional.auth_header
class AuthHeaderTestCase(ZopeTestCase.TestCase):
class AuthHeaderTestCase(TestCase):
def test_auth_encoded(self):
auth_header = functional.auth_header
header = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3'
self.assertEquals(auth_header(header), header)
def test_auth_non_encoded(self):
auth_header = functional.auth_header
header = 'Basic globalmgr:globalmgrpw'
expected = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3'
self.assertEquals(auth_header(header), expected)
def test_auth_non_encoded_empty(self):
auth_header = functional.auth_header
header = 'Basic globalmgr:'
expected = 'Basic Z2xvYmFsbWdyOg=='
self.assertEquals(auth_header(header), expected)
......@@ -35,17 +35,15 @@ class AuthHeaderTestCase(ZopeTestCase.TestCase):
self.assertEquals(auth_header(header), expected)
def test_auth_non_encoded_colon(self):
auth_header = functional.auth_header
header = 'Basic globalmgr:pass:pass'
expected = 'Basic Z2xvYmFsbWdyOnBhc3M6cGFzcw=='
self.assertEquals(auth_header(header), expected)
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(AuthHeaderTestCase))
return suite
return TestSuite((
makeSuite(AuthHeaderTestCase),
))
if __name__ == '__main__':
framework()
......
......@@ -2,20 +2,31 @@
# Example functional doctest
#
# $Id: testFunctionalDocTest.py,v 1.7 2005/02/16 14:21:59 shh42 Exp $
# $Id: testFunctionalDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
ZopeTestCase.installProduct('PythonScripts')
from unittest import TestSuite
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import FunctionalDocTestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
package = 'Testing.ZopeTestCase.ztc_doctest'
installProduct('PythonScripts')
def setUp(self):
'''This method will run after the test_class' setUp.
>>> print http(r"""
... GET /test_folder_1_/index_html HTTP/1.1
... """)
HTTP/1.1 200 OK
Content-Length: 5
Content-Type: text/plain
<BLANKLINE>
index
'''
self.folder.addDTMLDocument('index_html', file='index')
......@@ -27,11 +38,9 @@ def setUp(self):
def test_suite():
from unittest import TestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
return TestSuite((
FunctionalDocFileSuite('FunctionalDocTest.txt', package=package, setUp=setUp),
FunctionalDocTestSuite(setUp=setUp),
FunctionalDocFileSuite('FunctionalDocTest.txt', setUp=setUp),
))
if __name__ == '__main__':
......
#
# Example functional doctest
# Example doctest
#
# $Id: testWarningsTest.py,v 1.4 2005/02/16 14:21:59 shh42 Exp $
# $Id: testWarningsTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
package = 'Testing.ZopeTestCase.ztc_doctest'
from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
def test_suite():
from unittest import TestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
return TestSuite((
FunctionalDocFileSuite('WarningsTest.txt', package=package),
ZopeDocFileSuite('WarningsTest.txt'),
))
if __name__ == '__main__':
......
......@@ -2,29 +2,30 @@
# Example Zope doctest
#
# $Id: testZopeDocTest.py,v 1.2 2005/02/16 14:21:59 shh42 Exp $
# $Id: testZopeDocTest.py,v 1.2 2005/03/26 18:07:08 shh42 Exp $
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
package = 'Testing.ZopeTestCase.ztc_doctest'
from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocTestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
def setUp(self):
'''This method will run after the test_class' setUp.
>>> 'object' in folder.objectIds()
True
'''
self.folder.manage_addFolder('object', '')
def test_suite():
from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
return TestSuite((
ZopeDocFileSuite('ZopeDocTest.txt', package=package, setUp=setUp),
ZopeDocTestSuite(setUp=setUp),
ZopeDocFileSuite('ZopeDocTest.txt', setUp=setUp),
))
if __name__ == '__main__':
......
......@@ -4,9 +4,12 @@
# $Id: __init__.py,v 1.1 2005/02/25 11:01:07 shh42 Exp $
__version__ = '0.9.7'
import Testing.ZopeTestCase
__path__.extend(Testing.ZopeTestCase.__path__)
from Testing.ZopeTestCase import *
from Testing.ZopeTestCase import _print
from Testing.ZopeTestCase.utils import *
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment