[Checkins] SVN: five.grok/branches/sylvain-static-and-forms/src/five/grok/ - Add tests for static resource directory.
Sylvain Viollon
sylvain at infrae.com
Sat Aug 23 17:13:12 EDT 2008
Log message for revision 90162:
- Add tests for static resource directory.
Changed:
A five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/resource.py
A five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/
A five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/style.css
A five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/template.pt
A five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/resource.py
U five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/test_all.py
-=-
Added: five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/resource.py
===================================================================
--- five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/resource.py (rev 0)
+++ five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/resource.py 2008-08-23 21:13:11 UTC (rev 90162)
@@ -0,0 +1,28 @@
+"""
+
+ >>> from five.grok.ftests.view.argument import *
+
+ >>> from Products.Five.testbrowser import Browser
+ >>> browser = Browser()
+ >>> browser.handleErrors = False
+
+ We can access to our CSS file:
+
+ >>> browser.open("http://localhost/++resource++five.grok.ftests.view/style.css")
+ >>> print browser.contents
+ body {
+ color: green;
+ }
+ >>> print browser.headers['content-type']
+ text/css; charset=iso-8859-15
+
+ And the template file:
+
+ >>> browser.open("http://localhost/++resource++five.grok.ftests.view/template.pt")
+ >>> print browser.contents
+ <tal:test>This template should be considered as a file.</tal:test>
+ >>> print browser.headers['content-type']
+ text/html; charset=iso-8859-15
+
+
+"""
Added: five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/style.css
===================================================================
--- five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/style.css (rev 0)
+++ five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/style.css 2008-08-23 21:13:11 UTC (rev 90162)
@@ -0,0 +1,3 @@
+body {
+ color: green;
+}
Added: five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/template.pt
===================================================================
--- five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/template.pt (rev 0)
+++ five.grok/branches/sylvain-static-and-forms/src/five/grok/ftests/view/static/template.pt 2008-08-23 21:13:11 UTC (rev 90162)
@@ -0,0 +1 @@
+<tal:test>This template should be considered as a file.</tal:test>
Added: five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/resource.py
===================================================================
--- five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/resource.py (rev 0)
+++ five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/resource.py 2008-08-23 21:13:11 UTC (rev 90162)
@@ -0,0 +1,18 @@
+"""
+It is an error for the 'static' directory to be a python package:
+
+ >>> grok.testing.grok('five.grok.tests.all.staticispackage')
+ Traceback (most recent call last):
+ ...
+ GrokError: The 'static' resource directory must not be a python package.
+
+When a package contains a 'static' resource directory, it must not also contain
+a module called 'static.py':
+
+ >>> grok.testing.grok('five.grok.tests.all.statichaspy')
+ Traceback (most recent call last):
+ ...
+ GrokError: A package can not contain both a 'static' resource directory and a module named 'static.py'
+"""
+
+from five import grok
Modified: five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/test_all.py
===================================================================
--- five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/test_all.py 2008-08-23 21:02:06 UTC (rev 90161)
+++ five.grok/branches/sylvain-static-and-forms/src/five/grok/tests/test_all.py 2008-08-23 21:13:11 UTC (rev 90162)
@@ -98,6 +98,9 @@
module='five.grok.tests.subscribers',
setUp=setUp, tearDown=testing.tearDown),
+ doctestunit.DocTestSuite(
+ module='five.grok.tests.resource',
+ setUp=setUp, tearDown=testing.tearDown),
])
More information about the Checkins
mailing list