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: ...@@ -110,7 +110,7 @@ if not Zope2._began_startup:
_apply_patches() _apply_patches()
# Allow test authors to install Zope products into the test environment. Note # 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.Application import get_folder_permissions, get_products, install_product
from OFS.Folder import Folder from OFS.Folder import Folder
import Products import Products
...@@ -140,7 +140,7 @@ def installProduct(name, quiet=0): ...@@ -140,7 +140,7 @@ def installProduct(name, quiet=0):
if not quiet: _print('done (%.3fs)\n' % (time.time() - start)) if not quiet: _print('done (%.3fs)\n' % (time.time() - start))
break break
else: 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) if not quiet: _print('Installing %s ... NOT FOUND\n' % name)
def _load_control_panel(): def _load_control_panel():
...@@ -172,7 +172,7 @@ DB = Zope2.DB ...@@ -172,7 +172,7 @@ DB = Zope2.DB
configure = Zope2.configure configure = Zope2.configure
def startup(): pass def startup(): pass
# Provide a ZODB sandbox factory # ZODB sandbox factory
from ZODB.DemoStorage import DemoStorage from ZODB.DemoStorage import DemoStorage
def sandbox(base=None): def sandbox(base=None):
......
...@@ -33,6 +33,8 @@ from functional import Functional ...@@ -33,6 +33,8 @@ from functional import Functional
from ZODB.tests.warnhook import WarningsHook from ZODB.tests.warnhook import WarningsHook
from unittest import main from unittest import main
from ztc_doctest import ZopeDocFileSuite from zopedoctest import ZopeDocTestSuite
from ztc_doctest import FunctionalDocFileSuite from zopedoctest import ZopeDocFileSuite
from zopedoctest import FunctionalDocTestSuite
from zopedoctest import FunctionalDocFileSuite
...@@ -171,8 +171,8 @@ Class ZopeTestCase ...@@ -171,8 +171,8 @@ Class ZopeTestCase
Class FunctionalTestCase Class FunctionalTestCase
Convenience class for functional unit tests Convenience class for functional unit testing
(derived from ZopeTestCase) (derived from Functional and ZopeTestCase)
__implements__ = (Functional.__implements__, __implements__ = (Functional.__implements__,
ZopeTestCase.__implements__) ZopeTestCase.__implements__)
......
0.9.7 (Zope 2.8 edition) 0.9.7 (Zope 2.8 edition)
- Renamed 'doctest' sub-package to 'ztc_doctest' because of name-shadowing - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
issues uncovered during integration into Zope 2.8. This should not issues discovered during integration into Zope 2.8.
affect existing tests as user code is not expected to import from sub- - Greatly improved the doctest story. ZopeTestCase now implements four test
packages anyway. suite factories: ZopeDocTestSuite, ZopeDocFileSuite, FunctionalDocTestSuite,
and FunctionalDocFileSuite.
- Removed warnhook.py, we now use the one from ZODB.tests. - Removed warnhook.py, we now use the one from ZODB.tests.
- Removed doctest.py, we now use the one from zope.testing. - Removed doctest.py, we now use the one from zope.testing.
- Removed dochttp.py + test, we now use the one from zope.app.tests. - 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 0.9.6
- Dropped support for Zope 2.5 as it lacks the setSecurityManager() API. - Dropped support for Zope 2.5 as it lacks the setSecurityManager() API.
......
...@@ -60,15 +60,13 @@ and turn them into tests: ...@@ -60,15 +60,13 @@ and turn them into tests:
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
from unittest import TestSuite from unittest import TestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite from Testing.ZopeTestCase import FunctionalDocFileSuite
def test_suite(): def test_suite():
suite = TestSuite() return TestSuite((
suite.addTest(FunctionalDocFileSuite('FunctionalDocTest.txt')) FunctionalDocFileSuite('FunctionalDocTest.txt'),
return suite ))
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
Doctest support for ZopeTestCase Doc test support for ZopeTestCase
================================ =================================
Backport of functional doc tests from Zope 3 by Backport of functional doc tests from Zope 3 by
Sidnei da Silva. See 'FunctionalDocTest.txt' for Sidnei da Silva. See 'FunctionalDocTest.txt' for
......
Dummy Test 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 that doesn't subclass ``ZopeTestCase.Functional`` still works but
issues a warning. issues a warning.
>>> from Testing import ZopeTestCase >>> from Testing import ZopeTestCase as zopetest
>>> class NoFunctionalTest(ZopeTestCase.ZopeTestCase): pass >>> hook = zopetest.WarningsHook()
>>> hook = ZopeTestCase.WarningsHook()
>>> hook.install() >>> hook.install()
>>> test = ZopeTestCase.FunctionalDocFileSuite('WarningsTest.txt', >>> suite = zopetest.FunctionalDocFileSuite('WarningsTest.txt',
... package='Testing.ZopeTestCase.ztc_doctest', ... package=zopetest.zopedoctest,
... test_class=NoFunctionalTest) ... test_class=zopetest.ZopeTestCase)
>>> len(hook.warnings) >>> len(hook.warnings)
1 1
>>> message, category, filename, lineno = hook.warnings[0] >>> message, category, filename, lineno = hook.warnings[0]
>>> message >>> message
"The test_class you are using doesn't subclass from ZopeTestCase.Functional. Please fix that." "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. ...@@ -30,15 +30,13 @@ infrastructure to set up the necessary environment.
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
from unittest import TestSuite from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite from Testing.ZopeTestCase import ZopeDocFileSuite
def test_suite(): def test_suite():
suite = TestSuite() return TestSuite((
suite.addTest(ZopeDocFileSuite('ZopeDocTest.txt')) ZopeDocFileSuite('ZopeDocTest.txt'),
return suite ))
if __name__ == '__main__': if __name__ == '__main__':
framework() 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 zope.testing.doctest import *
from functional import * from functional import *
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
# Support for functional doc tests # 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 sys, re, base64
import re
import base64
import warnings import warnings
from zope.testing import doctest from zope.testing import doctest
from Testing.ZopeTestCase import Functional
from Testing.ZopeTestCase import FunctionalTestCase
from Testing.ZopeTestCase import ZopeTestCase 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_name
from Testing.ZopeTestCase import user_password 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.sandbox import AppZapper
from Testing.ZopeTestCase.functional import ResponseWrapper from Testing.ZopeTestCase.functional import ResponseWrapper
...@@ -57,7 +57,7 @@ class HTTPHeaderOutput: ...@@ -57,7 +57,7 @@ class HTTPHeaderOutput:
class DocResponseWrapper(ResponseWrapper): class DocResponseWrapper(ResponseWrapper):
"""Response Wrapper for use in doc tests """Response Wrapper for use in doctests
""" """
def __init__(self, response, outstream, path, header_output): def __init__(self, response, outstream, path, header_output):
...@@ -168,7 +168,7 @@ def http(request_string, handle_errors=True): ...@@ -168,7 +168,7 @@ def http(request_string, handle_errors=True):
header_output.setResponseHeaders(response.headers) header_output.setResponseHeaders(response.headers)
# Restore previous security manager, which may have been changed # Restore previous security manager, which may have been changed
# by calling the publish method above. # by calling the publish method above
setSecurityManager(old_sm) setSecurityManager(old_sm)
# Sync connection # Sync connection
...@@ -177,82 +177,150 @@ def http(request_string, handle_errors=True): ...@@ -177,82 +177,150 @@ def http(request_string, handle_errors=True):
return DocResponseWrapper(response, outstream, path, header_output) return DocResponseWrapper(response, outstream, path, header_output)
def FunctionalDocFileSuite(*paths, **kw): class ZopeSuiteFactory:
globs = kw.setdefault('globs', {})
globs['http'] = http def __init__(self, *args, **kw):
globs['getRootFolder'] = getRootFolder self._args = args
globs['sync'] = sync self._kw = kw
globs['user_auth'] = base64.encodestring('%s:%s' % (user_name, user_password)) self.run()
test_class = kw.get('test_class', FunctionalTestCase) def doctestsuite(self):
return doctest.DocTestSuite(*self._args, **self._kw)
# Must call here or it may guess the package wrongly
kw['package'] = doctest._normalize_module(kw.get('package')) def docfilesuite(self):
return doctest.DocFileSuite(*self._args, **self._kw)
# If the passed-in test_class doesn't subclass Functional,
# we mix it in for you, but we will issue a warning. def run(self):
if not issubclass(test_class, Functional): self.setup_globs()
name = test_class.__name__ self.setup_test_class()
warnings.warn(("The test_class you are using doesn't " self.setup_optionflags()
"subclass from ZopeTestCase.Functional. "
"Please fix that."), UserWarning, 2) def setup_globs(self):
if not 'Functional' in name: globs = self._kw.setdefault('globs', {})
name = 'Functional%s' % name globs['user_name'] = user_name
test_class = type(name, (Functional, test_class), {}) globs['user_password'] = user_password
globs['user_role'] = user_role
kw['test_class'] = test_class globs['standard_permissions'] = standard_permissions
return ZopeDocFileSuite(*paths, **kw)
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): def ZopeDocFileSuite(*paths, **kw):
globs = kw.setdefault('globs', {}) if kw.get('module_relative', True):
kw['package'] = doctest._normalize_module(kw.get('package'))
test_class = kw.get('test_class', ZopeTestCase) 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 def FunctionalDocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **kw):
# execute the setUp and tearDown methods, as well as if globs is not None:
# be passed into the test globals as 'self'. kw['globs'] = globs
test_instance = test_class() 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 def FunctionalDocFileSuite(*paths, **kw):
kw['package'] = doctest._normalize_module(kw.get('package')) if kw.get('module_relative', True):
kw['package'] = doctest._normalize_module(kw.get('package'))
kwsetUp = kw.get('setUp') return FunctionalSuiteFactory(*paths, **kw).docfilesuite()
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)
__all__ = [ __all__ = [
'FunctionalDocFileSuite', 'ZopeDocTestSuite',
'ZopeDocFileSuite', '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 @@ ...@@ -2,31 +2,31 @@
# Test for auth_header # 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 import os, sys
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase from unittest import TestSuite, makeSuite
from Testing.ZopeTestCase.ztc_doctest import functional 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): def test_auth_encoded(self):
auth_header = functional.auth_header
header = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3' header = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3'
self.assertEquals(auth_header(header), header) self.assertEquals(auth_header(header), header)
def test_auth_non_encoded(self): def test_auth_non_encoded(self):
auth_header = functional.auth_header
header = 'Basic globalmgr:globalmgrpw' header = 'Basic globalmgr:globalmgrpw'
expected = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3' expected = 'Basic Z2xvYmFsbWdyOmdsb2JhbG1ncnB3'
self.assertEquals(auth_header(header), expected) self.assertEquals(auth_header(header), expected)
def test_auth_non_encoded_empty(self): def test_auth_non_encoded_empty(self):
auth_header = functional.auth_header
header = 'Basic globalmgr:' header = 'Basic globalmgr:'
expected = 'Basic Z2xvYmFsbWdyOg==' expected = 'Basic Z2xvYmFsbWdyOg=='
self.assertEquals(auth_header(header), expected) self.assertEquals(auth_header(header), expected)
...@@ -35,17 +35,15 @@ class AuthHeaderTestCase(ZopeTestCase.TestCase): ...@@ -35,17 +35,15 @@ class AuthHeaderTestCase(ZopeTestCase.TestCase):
self.assertEquals(auth_header(header), expected) self.assertEquals(auth_header(header), expected)
def test_auth_non_encoded_colon(self): def test_auth_non_encoded_colon(self):
auth_header = functional.auth_header
header = 'Basic globalmgr:pass:pass' header = 'Basic globalmgr:pass:pass'
expected = 'Basic Z2xvYmFsbWdyOnBhc3M6cGFzcw==' expected = 'Basic Z2xvYmFsbWdyOnBhc3M6cGFzcw=='
self.assertEquals(auth_header(header), expected) self.assertEquals(auth_header(header), expected)
def test_suite(): def test_suite():
from unittest import TestSuite, makeSuite return TestSuite((
suite = TestSuite() makeSuite(AuthHeaderTestCase),
suite.addTest(makeSuite(AuthHeaderTestCase)) ))
return suite
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
...@@ -2,20 +2,31 @@ ...@@ -2,20 +2,31 @@
# Example functional doctest # 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 import os, sys
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase from unittest import TestSuite
ZopeTestCase.installProduct('PythonScripts') 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): def setUp(self):
'''This method will run after the test_class' setUp. '''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') self.folder.addDTMLDocument('index_html', file='index')
...@@ -27,11 +38,9 @@ def setUp(self): ...@@ -27,11 +38,9 @@ def setUp(self):
def test_suite(): def test_suite():
from unittest import TestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
return TestSuite(( return TestSuite((
FunctionalDocFileSuite('FunctionalDocTest.txt', package=package, setUp=setUp), FunctionalDocTestSuite(setUp=setUp),
FunctionalDocFileSuite('FunctionalDocTest.txt', setUp=setUp),
)) ))
if __name__ == '__main__': 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 import os, sys
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
package = 'Testing.ZopeTestCase.ztc_doctest'
def test_suite(): def test_suite():
from unittest import TestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite
return TestSuite(( return TestSuite((
FunctionalDocFileSuite('WarningsTest.txt', package=package), ZopeDocFileSuite('WarningsTest.txt'),
)) ))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -2,29 +2,30 @@ ...@@ -2,29 +2,30 @@
# Example Zope doctest # 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 import os, sys
if __name__ == '__main__': if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py')) execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocTestSuite
package = 'Testing.ZopeTestCase.ztc_doctest' from Testing.ZopeTestCase import ZopeDocFileSuite
def setUp(self): def setUp(self):
'''This method will run after the test_class' setUp. '''This method will run after the test_class' setUp.
>>> 'object' in folder.objectIds()
True
''' '''
self.folder.manage_addFolder('object', '') self.folder.manage_addFolder('object', '')
def test_suite(): def test_suite():
from unittest import TestSuite
from Testing.ZopeTestCase import ZopeDocFileSuite
return TestSuite(( return TestSuite((
ZopeDocFileSuite('ZopeDocTest.txt', package=package, setUp=setUp), ZopeDocTestSuite(setUp=setUp),
ZopeDocFileSuite('ZopeDocTest.txt', setUp=setUp),
)) ))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
# $Id: __init__.py,v 1.1 2005/02/25 11:01:07 shh42 Exp $ # $Id: __init__.py,v 1.1 2005/02/25 11:01:07 shh42 Exp $
__version__ = '0.9.7'
import Testing.ZopeTestCase import Testing.ZopeTestCase
__path__.extend(Testing.ZopeTestCase.__path__) __path__.extend(Testing.ZopeTestCase.__path__)
from Testing.ZopeTestCase import * from Testing.ZopeTestCase import *
from Testing.ZopeTestCase import _print
from Testing.ZopeTestCase.utils import * 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