[Checkins] SVN: Sandbox/darrylcousins/mars.contentprovider/ Changed
and expanded functional tests
Darryl Cousins
darryl at darrylcousins.net.nz
Mon Jul 16 01:56:44 EDT 2007
Log message for revision 78015:
Changed and expanded functional tests
Changed:
U Sandbox/darrylcousins/mars.contentprovider/buildout.cfg
U Sandbox/darrylcousins/mars.contentprovider/setup.py
U Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/README.txt
U Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/contentprovider.py
A Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/description.pt
U Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/ftesting.zcml
U Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/index.pt
D Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_all.py
A Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_functional.py
-=-
Modified: Sandbox/darrylcousins/mars.contentprovider/buildout.cfg
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/buildout.cfg 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/buildout.cfg 2007-07-16 05:56:43 UTC (rev 78015)
@@ -5,6 +5,9 @@
[test]
recipe = zc.recipe.testrunner
eggs = mars.contentprovider [test]
+defaults = ['--tests-pattern', '^f?tests$',
+ '-v'
+ ]
[zope3]
location = .
Modified: Sandbox/darrylcousins/mars.contentprovider/setup.py
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/setup.py 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/setup.py 2007-07-16 05:56:43 UTC (rev 78015)
@@ -24,24 +24,15 @@
dependency_links = ['http://download.zope.org/distribution'],
extras_require = dict(
test=['zope.app.testing',
- 'zope.testbrowser',
- 'zope.app.zcmlfiles',
- 'zope.app.securitypolicy',
- 'zope.app.authentication',
'mars.layer',
'mars.template',
- 'mars.view',
+ 'zope.app.securitypolicy',
]
),
install_requires = [
'setuptools',
- 'zope.app.intid',
- 'zope.app.catalog',
- 'zope.component',
- 'zope.interface',
- 'zope.publisher',
- 'zope.contentprovider',
'grok',
- 'martian',
+ 'zope.contentprovider',
+ 'mars.view',
],
)
Modified: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/README.txt
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/README.txt 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/README.txt 2007-07-16 05:56:43 UTC (rev 78015)
@@ -18,10 +18,6 @@
Mars ContentProvider
--------------------
-Martian is a library that allows the embedding of configuration
-information in Python code. Martian can then grok the system and
-do the appropriate configuration registrations.
-
The mars.contentprovider package provides the means of creating and configuring
``contentproviders`` for an application using Zope3.
@@ -30,17 +26,8 @@
::
- import mars.view
- import mars.template
import mars.contentprovider
- class Index(mars.view.LayoutView):
- pass
-
- class IndexLayout(mars.template.LayoutFactory):
- grok.template('index.pt')
- grok.context(Index)
-
class Title(mars.contentprovider.ContentProvider):
def render(self):
Modified: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/contentprovider.py
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/contentprovider.py 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/contentprovider.py 2007-07-16 05:56:43 UTC (rev 78015)
@@ -1,7 +1,7 @@
"""
>>> import grok
- >>> grok.grok('mars.contentprovider.tests.contentprovider')
- >>> from mars.contentprovider.tests.contentprovider import Mammoth
+ >>> grok.grok('mars.contentprovider.ftests.contentprovider')
+ >>> from mars.contentprovider.ftests.contentprovider import Mammoth
>>> getRootFolder()["mammoth"] = Mammoth()
>>> from zope.testbrowser.testing import Browser
@@ -11,9 +11,12 @@
>>> browser.open(skinURL + '/mammoth/@@index')
>>> print browser.contents
<div>
- I am Manfred the Mammoth
+ <p>I am Manfred the Mammoth</p>
+ <p>A friendly mammoth</p>
+ <p>Most like a mammoth, but some don't.</p>
</div>
+
"""
import grok
@@ -32,6 +35,7 @@
pass
class Mammoth(grok.Model):
+ """This is the assumed context for the module"""
title = u'Manfred'
class Index(mars.view.LayoutView):
@@ -42,7 +46,26 @@
grok.context(Index)
class Title(mars.contentprovider.ContentProvider):
+ """Title uses the render method"""
def render(self):
return self.context.title
+class Description(mars.contentprovider.ContentProvider):
+ """Description will use the following template"""
+ pass
+
+class DescriptionTemplate(mars.template.TemplateFactory):
+ grok.template('description.pt')
+ grok.context(Description)
+
+class Comment(mars.contentprovider.ContentProvider):
+ """Comment will call update before render"""
+ comment = u''
+
+ def update(self):
+ self.comment = u"Most like a mammoth, but some don't."
+
+ def render(self):
+ self.update()
+ return self.comment
Added: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/description.pt
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/description.pt (rev 0)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/description.pt 2007-07-16 05:56:43 UTC (rev 78015)
@@ -0,0 +1 @@
+<p>A friendly mammoth</p>
Modified: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/ftesting.zcml
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/ftesting.zcml 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/ftesting.zcml 2007-07-16 05:56:43 UTC (rev 78015)
@@ -10,8 +10,7 @@
<include package="mars.view" file="meta.zcml" />
<include package="mars.contentprovider" file="meta.zcml" />
- <include package="z3c.layer.minimal.tests" file="ftesting.zcml" />
-
+ <include package="grok" />
<include package="zope.contentprovider" />
</configure>
Modified: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/index.pt
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/index.pt 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/index.pt 2007-07-16 05:56:43 UTC (rev 78015)
@@ -1,3 +1,5 @@
<div>
-I am <tal:block tal:content="structure provider:title" /> the Mammoth
+<p>I am <tal:block tal:content="structure provider:title" /> the Mammoth</p>
+<tal:block replace="structure provider:description" />
+<p tal:content="structure provider:comment" />
</div>
Deleted: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_all.py
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_all.py 2007-07-16 05:22:27 UTC (rev 78014)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_all.py 2007-07-16 05:56:43 UTC (rev 78015)
@@ -1,30 +0,0 @@
-import unittest
-from zope.testing import doctest
-
-from zope.app.testing.functional import FunctionalTestSetup
-from zope.app.testing import functional
-functional.defineLayer('TestLayer', 'ftesting.zcml')
-
-optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
-
-def setUp(test):
- FunctionalTestSetup().setUp()
-
-def tearDown(test):
- FunctionalTestSetup().tearDown()
-
-def test_suite():
- suite = unittest.TestSuite()
- dottedname = 'mars.contentprovider.ftests.contentprovider'
- test = doctest.DocTestSuite(
- dottedname, setUp=setUp,
- tearDown=tearDown, optionflags=optionflags)
- test.layer = TestLayer
- suite.addTest(test)
- return suite
-
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
-
Added: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_functional.py
===================================================================
--- Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_functional.py (rev 0)
+++ Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_functional.py 2007-07-16 05:56:43 UTC (rev 78015)
@@ -0,0 +1,31 @@
+import unittest
+from zope.testing import doctest
+
+from zope.app.testing.functional import FunctionalTestSetup, getRootFolder
+from zope.app.testing import functional
+functional.defineLayer('TestLayer', 'ftesting.zcml')
+
+optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
+globs = dict(getRootFolder=getRootFolder)
+
+def setUp(test):
+ FunctionalTestSetup().setUp()
+
+def tearDown(test):
+ FunctionalTestSetup().tearDown()
+
+def test_suite():
+ suite = unittest.TestSuite()
+ dottedname = 'mars.contentprovider.ftests.contentprovider'
+ test = doctest.DocTestSuite(
+ dottedname, setUp=setUp, globs=globs,
+ tearDown=tearDown, optionflags=optionflags)
+ test.layer = TestLayer
+ suite.addTest(test)
+ return suite
+
+
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
+
Property changes on: Sandbox/darrylcousins/mars.contentprovider/src/mars/contentprovider/ftests/test_functional.py
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the Checkins
mailing list