[Checkins] SVN: z3c.contents/branches/darrylcousins/ Added browser
test setup
Darryl Cousins
darryl at darrylcousins.net.nz
Mon Mar 10 01:13:02 EDT 2008
Log message for revision 84561:
Added browser test setup
Changed:
U z3c.contents/branches/darrylcousins/buildout.cfg
_U z3c.contents/branches/darrylcousins/externals/
U z3c.contents/branches/darrylcousins/setup.py
A z3c.contents/branches/darrylcousins/src/z3c/contents/BROWSER.txt
A z3c.contents/branches/darrylcousins/src/z3c/contents/ftesting.zcml
A z3c.contents/branches/darrylcousins/src/z3c/contents/ftests.py
A z3c.contents/branches/darrylcousins/src/z3c/contents/testing.pt
U z3c.contents/branches/darrylcousins/src/z3c/contents/testing.py
-=-
Modified: z3c.contents/branches/darrylcousins/buildout.cfg
===================================================================
--- z3c.contents/branches/darrylcousins/buildout.cfg 2008-03-10 03:09:42 UTC (rev 84560)
+++ z3c.contents/branches/darrylcousins/buildout.cfg 2008-03-10 05:12:50 UTC (rev 84561)
@@ -1,12 +1,12 @@
[buildout]
develop = .
- externals/z3c.table
parts = test checker coverage
[test]
recipe = zc.recipe.testrunner
eggs = z3c.contents [test]
+defaults = ['--tests-pattern', '^f?tests$', '-v']
[checker]
Property changes on: z3c.contents/branches/darrylcousins/externals
___________________________________________________________________
Name: svn:externals
- z3c.table svn://svn.zope.org/repos/main/z3c.table/trunk
+
Modified: z3c.contents/branches/darrylcousins/setup.py
===================================================================
--- z3c.contents/branches/darrylcousins/setup.py 2008-03-10 03:09:42 UTC (rev 84560)
+++ z3c.contents/branches/darrylcousins/setup.py 2008-03-10 05:12:50 UTC (rev 84561)
@@ -52,7 +52,11 @@
extras_require = dict(
test = [
'z3c.macro',
+ 'z3c.layer.ready2go',
+ 'z3c.pagelet',
'z3c.table',
+ 'z3c.etestbrowser',
+ 'zope.app.securitypolicy',
'zope.app.pagetemplate',
'zope.app.testing',
'zope.component',
@@ -76,4 +80,4 @@
'zope.traversing',
],
zip_safe = False,
-)
\ No newline at end of file
+)
Added: z3c.contents/branches/darrylcousins/src/z3c/contents/BROWSER.txt
===================================================================
--- z3c.contents/branches/darrylcousins/src/z3c/contents/BROWSER.txt (rev 0)
+++ z3c.contents/branches/darrylcousins/src/z3c/contents/BROWSER.txt 2008-03-10 05:12:50 UTC (rev 84561)
@@ -0,0 +1,12 @@
+z3c.contents
+============
+
+ >>> from z3c.etestbrowser.testing import ExtendedTestBrowser
+ >>> import zope.component
+ >>> browser = ExtendedTestBrowser()
+ >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+ >>> browser.handleErrors = False
+ >>> URL = 'http://localhost/++skin++ContentsTesting%s'
+
+ >>> browser.open(URL % '/')
+ >>> #print browser.contents
Property changes on: z3c.contents/branches/darrylcousins/src/z3c/contents/BROWSER.txt
___________________________________________________________________
Name: svn:keywords
+ Date Author
Added: z3c.contents/branches/darrylcousins/src/z3c/contents/ftesting.zcml
===================================================================
--- z3c.contents/branches/darrylcousins/src/z3c/contents/ftesting.zcml (rev 0)
+++ z3c.contents/branches/darrylcousins/src/z3c/contents/ftesting.zcml 2008-03-10 05:12:50 UTC (rev 84561)
@@ -0,0 +1,84 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:z3c="http://namespaces.zope.org/z3c"
+ i18n_domain="demo">
+
+ <include package="zope.app.component" file="meta.zcml" />
+ <include package="zope.app.component.browser" file="meta.zcml" />
+ <include package="zope.app.container.browser" file="meta.zcml" />
+ <include package="zope.app.form.browser" file="meta.zcml" />
+ <include package="zope.app.pagetemplate" file="meta.zcml" />
+ <include package="zope.app.publication" file="meta.zcml" />
+ <include package="zope.app.publisher" file="meta.zcml" />
+ <include package="zope.app.security" file="meta.zcml" />
+ <include package="zope.app.securitypolicy" file="meta.zcml" />
+ <include package="zope.viewlet" file="meta.zcml" />
+ <include package="z3c.form" file="meta.zcml" />
+ <include package="z3c.macro" file="meta.zcml" />
+ <include package="z3c.pagelet" file="meta.zcml" />
+ <include package="z3c.template" file="meta.zcml" />
+
+ <browser:menu id="zmi_views" title="Views" />
+ <browser:menu id="zmi_actions" title="Actions" />
+
+ <include package="zope.app.appsetup" />
+ <include package="zope.app.component" />
+ <include package="zope.app.container" />
+ <include package="zope.app.error" />
+ <include package="zope.app.folder" />
+ <include package="zope.app.i18n" />
+ <include package="zope.app.publication" />
+ <include package="zope.app.security" />
+ <include package="zope.app.securitypolicy" />
+ <include package="zope.app.session" />
+ <include package="zope.app.wsgi" />
+ <include package="zope.annotation" />
+ <include package="zope.component" />
+ <include package="zope.contentprovider" />
+ <include package="zope.location" />
+ <include package="zope.publisher" />
+ <include package="zope.traversing" />
+ <include package="zope.traversing.browser" />
+ <include package="zope.viewlet" />
+
+ <include package="z3c.form" />
+ <include package="z3c.formui" />
+ <include package="z3c.macro" />
+ <include package="z3c.pagelet" />
+ <include package="z3c.table" />
+ <include package="z3c.contents" />
+
+ <securityPolicy
+ component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+ <role id="zope.Anonymous" title="Everybody" />
+ <grantAll role="zope.Anonymous" />
+
+ <browser:defaultView
+ for="*"
+ name="index"
+ />
+
+ <interface
+ interface="z3c.contents.testing.IContentsTestBrowserSkin"
+ type="zope.publisher.interfaces.browser.IBrowserSkinType"
+ name="ContentsTesting"
+ />
+
+ <z3c:layout
+ for="*"
+ layer="z3c.contents.testing.IContentsTestBrowserLayer"
+ template="testing.pt"
+ />
+
+ <!-- test contents page for the root folder -->
+ <z3c:pagelet
+ name="index"
+ for="zope.app.folder.interfaces.IRootFolder"
+ class="z3c.contents.browser.ContentsPage"
+ layer="z3c.contents.testing.IContentsTestBrowserLayer"
+ permission="zope.ManageContent"
+ />
+
+</configure>
Added: z3c.contents/branches/darrylcousins/src/z3c/contents/ftests.py
===================================================================
--- z3c.contents/branches/darrylcousins/src/z3c/contents/ftests.py (rev 0)
+++ z3c.contents/branches/darrylcousins/src/z3c/contents/ftests.py 2008-03-10 05:12:50 UTC (rev 84561)
@@ -0,0 +1,29 @@
+import os
+import doctest
+import transaction
+
+from zope.app.testing import functional
+import zope.component
+
+ftesting_zcml = os.path.join(os.path.dirname(__file__),
+ 'ftesting.zcml')
+TestLayer = functional.ZCMLLayer(
+ ftesting_zcml, __name__, 'TestLayer')
+
+def setUp(test):
+ functional.FunctionalTestSetup().setUp()
+ test.globs['getRootFolder'] = functional.getRootFolder
+
+def tearDown(test):
+ functional.FunctionalTestSetup().tearDown()
+
+def test_suite():
+ suite = functional.FunctionalDocFileSuite('BROWSER.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+ )
+ suite.layer = TestLayer
+ return suite
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Property changes on: z3c.contents/branches/darrylcousins/src/z3c/contents/ftests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3c.contents/branches/darrylcousins/src/z3c/contents/testing.pt
===================================================================
--- z3c.contents/branches/darrylcousins/src/z3c/contents/testing.pt (rev 0)
+++ z3c.contents/branches/darrylcousins/src/z3c/contents/testing.pt 2008-03-10 05:12:50 UTC (rev 84561)
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W4C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title>Contents</title>
+</head>
+<body>
+ <tal:block replace="structure provider:pagelet">
+ content
+ </tal:block>
+</body>
+</html>
+
Modified: z3c.contents/branches/darrylcousins/src/z3c/contents/testing.py
===================================================================
--- z3c.contents/branches/darrylcousins/src/z3c/contents/testing.py 2008-03-10 03:09:42 UTC (rev 84560)
+++ z3c.contents/branches/darrylcousins/src/z3c/contents/testing.py 2008-03-10 05:12:50 UTC (rev 84561)
@@ -16,7 +16,16 @@
"""
__docformat__ = "reStructuredText"
+from zope.publisher.interfaces.browser import IBrowserRequest
+import z3c.layer.ready2go
+
+class IContentsTestBrowserLayer(z3c.layer.ready2go.IReady2GoBrowserLayer):
+ """test layer."""
+
+class IContentsTestBrowserSkin(IContentsTestBrowserLayer):
+ """The browser skin."""
+
class Content(object):
"""Sample content which is pickable for copy test."""
def __init__(self, title, number):
More information about the Checkins
mailing list