This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaned up test setup. Use a simple http server instead of a local fi…
…le url in the security test
- Loading branch information
1 parent
9eec587
commit d9e7595
Showing
5 changed files
with
60 additions
and
126 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import doctest | ||
import re | ||
import unittest | ||
import grokui.admin | ||
|
||
import zc.buildout.testing | ||
from zope.testing import renormalizing | ||
from zope.app.wsgi.testlayer import BrowserLayer | ||
|
||
checker = renormalizing.RENormalizing([ | ||
# Accommodate to exception wrapping in newer versions of mechanize | ||
(re.compile(r'httperror_seek_wrapper:', re.M), 'HTTPError:'), | ||
]) | ||
|
||
def test_suite(): | ||
suite = unittest.TestSuite() | ||
functional_layer = BrowserLayer(grokui.admin.tests) | ||
optionflags=(doctest.ELLIPSIS + | ||
doctest.NORMALIZE_WHITESPACE + | ||
doctest.REPORT_NDIFF) | ||
globs=dict(getRootFolder=functional_layer.getRootFolder) | ||
|
||
tests = [ | ||
'apps', | ||
'brokenapps', | ||
'brokenobjs', | ||
'events', | ||
'infoviews', | ||
'packdatabase', | ||
'server'] | ||
|
||
for filename in tests: | ||
test = doctest.DocTestSuite( | ||
'grokui.admin.tests.' + filename, | ||
checker=checker, | ||
globs=globs, | ||
optionflags=optionflags, | ||
) | ||
test.layer = functional_layer | ||
suite.addTest(test) | ||
|
||
security_test = doctest.DocTestSuite( | ||
'grokui.admin.tests.security', | ||
checker=checker, | ||
globs=globs, | ||
optionflags=optionflags, | ||
# In order to start a tiny http server in the test. | ||
setUp=zc.buildout.testing.buildoutSetUp, | ||
tearDown=zc.buildout.testing.buildoutTearDown, | ||
) | ||
security_test.layer = functional_layer | ||
suite.addTest(security_test) | ||
return suite |