[Checkins] SVN: Sandbox/baijum/z3hello/trunk/ - minimal functional testing
Baiju M
baiju.m.mail at gmail.com
Sat Jan 2 12:11:27 EST 2010
Log message for revision 107560:
- minimal functional testing
- move 'log' location
Changed:
U Sandbox/baijum/z3hello/trunk/debug.ini
D Sandbox/baijum/z3hello/trunk/log/
U Sandbox/baijum/z3hello/trunk/setup.py
A Sandbox/baijum/z3hello/trunk/src/z3hello/README.txt
A Sandbox/baijum/z3hello/trunk/src/z3hello/ftesting.zcml
A Sandbox/baijum/z3hello/trunk/src/z3hello/tests.py
-=-
Modified: Sandbox/baijum/z3hello/trunk/debug.ini
===================================================================
--- Sandbox/baijum/z3hello/trunk/debug.ini 2010-01-02 17:06:43 UTC (rev 107559)
+++ Sandbox/baijum/z3hello/trunk/debug.ini 2010-01-02 17:11:26 UTC (rev 107560)
@@ -21,7 +21,7 @@
[handler_accesslog]
class = FileHandler
-args = (os.path.join(r'log', 'access.log'),
+args = (os.path.join('var', 'log', 'access.log'),
'a')
level = INFO
formatter = accesslog
Modified: Sandbox/baijum/z3hello/trunk/setup.py
===================================================================
--- Sandbox/baijum/z3hello/trunk/setup.py 2010-01-02 17:06:43 UTC (rev 107559)
+++ Sandbox/baijum/z3hello/trunk/setup.py 2010-01-02 17:11:26 UTC (rev 107560)
@@ -69,6 +69,9 @@
'zope.app.schema',
'zope.app.container',
'zope.app.debug',
+ 'z3c.testsetup',
+ 'zope.app.testing',
+ 'zope.testbrowser',
],
include_package_data=True,
Added: Sandbox/baijum/z3hello/trunk/src/z3hello/README.txt
===================================================================
--- Sandbox/baijum/z3hello/trunk/src/z3hello/README.txt (rev 0)
+++ Sandbox/baijum/z3hello/trunk/src/z3hello/README.txt 2010-01-02 17:11:26 UTC (rev 107560)
@@ -0,0 +1,13 @@
+z3hello
+=======
+
+:doctest:
+:functional-zcml-layer: ftesting.zcml
+
+Open browser and test::
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> browser = Browser()
+ >>> browser.open('http://localhost/@@hello')
+ >>> browser.contents
+ 'Hello'
Added: Sandbox/baijum/z3hello/trunk/src/z3hello/ftesting.zcml
===================================================================
--- Sandbox/baijum/z3hello/trunk/src/z3hello/ftesting.zcml (rev 0)
+++ Sandbox/baijum/z3hello/trunk/src/z3hello/ftesting.zcml 2010-01-02 17:11:26 UTC (rev 107560)
@@ -0,0 +1,54 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ >
+
+ <include package="zope.component" file="meta.zcml" />
+ <include package="zope.security" file="meta.zcml" />
+ <include package="zope.publisher" file="meta.zcml" />
+ <include package="zope.browserresource" file="meta.zcml" />
+ <include package="zope.browsermenu" file="meta.zcml" />
+ <include package="zope.browserpage" file="meta.zcml" />
+ <include package="zope.securitypolicy" file="meta.zcml" />
+ <include package="zope.principalregistry" file="meta.zcml" />
+ <include package="zope.app.publication" file="meta.zcml" />
+
+ <include package="zope.component" />
+ <include package="zope.traversing" />
+ <include package="zope.site" />
+ <include package="zope.annotation" />
+ <include package="zope.container" />
+ <include package="zope.componentvocabulary" />
+ <include package="zope.app.appsetup" />
+ <include package="zope.app.security" />
+ <include package="zope.app.publication" />
+ <include package="zope.principalregistry" />
+
+ <include package="z3hello" file="securitypolicy.zcml" />
+ <include package="z3hello" file="application.zcml" />
+
+ <!-- Typical functional testing security setup -->
+ <securityPolicy
+ component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+ />
+
+ <unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User"
+ />
+ <grant
+ permission="zope.View"
+ principal="zope.anybody"
+ />
+
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw"
+ />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager" principal="zope.mgr" />
+
+</configure>
Added: Sandbox/baijum/z3hello/trunk/src/z3hello/tests.py
===================================================================
--- Sandbox/baijum/z3hello/trunk/src/z3hello/tests.py (rev 0)
+++ Sandbox/baijum/z3hello/trunk/src/z3hello/tests.py 2010-01-02 17:11:26 UTC (rev 107560)
@@ -0,0 +1,12 @@
+import os.path
+import z3c.testsetup
+import z3hello
+from zope.app.testing.functional import ZCMLLayer
+
+
+ftesting_zcml = os.path.join(
+ os.path.dirname(z3hello.__file__), 'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer',
+ allow_teardown=True)
+
+test_suite = z3c.testsetup.register_all_tests('z3hello')
More information about the checkins
mailing list