[Checkins] SVN: grokproject/branches/janjaapdriessen-hurry.resource/ Update tests in the resulting package to use the fanstatic layer. Fix tests.

Jan-Jaap Driessen jdriessen at thehealthagency.com
Fri Dec 3 10:55:51 EST 2010


Log message for revision 118682:
  Update tests in the resulting package to use the fanstatic layer. Fix tests.

Changed:
  U   grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/buildout.cfg_tmpl
  U   grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/setup.py_tmpl
  U   grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/app.txt_tmpl
  U   grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/tests.py_tmpl
  U   grokproject/branches/janjaapdriessen-hurry.resource/grokproject/templates.py
  U   grokproject/branches/janjaapdriessen-hurry.resource/tests_paste.txt

-=-
Modified: grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/buildout.cfg_tmpl
===================================================================
--- grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/buildout.cfg_tmpl	2010-12-03 15:50:05 UTC (rev 118681)
+++ grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/buildout.cfg_tmpl	2010-12-03 15:55:51 UTC (rev 118682)
@@ -37,6 +37,8 @@
 zope.fanstatic = svn http://svn.zope.org/repos/main/zope.fanstatic/trunk
 
 [versions]
+WebOb = 1.0
+zope.app.wsgi = 3.10.0
 # Override versions here.
 
 # Once groktoolkit 1.2 is released, remove this line:

Modified: grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/setup.py_tmpl	2010-12-03 15:50:05 UTC (rev 118681)
+++ grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/setup.py_tmpl	2010-12-03 15:55:51 UTC (rev 118682)
@@ -29,6 +29,6 @@
                         ],
       entry_points={
           'fanstatic.libraries': [
-              'foo = ${project}.resource:library',
+              'foo = ${project_lowercase}.resource:library',
           ]
       })

Modified: grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/app.txt_tmpl
===================================================================
--- grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/app.txt_tmpl	2010-12-03 15:50:05 UTC (rev 118681)
+++ grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/app.txt_tmpl	2010-12-03 15:55:51 UTC (rev 118682)
@@ -32,6 +32,10 @@
     >>> print browser.contents
     <html>
     <head>
+      <link rel="stylesheet" type="text/css"
+            href="http://localhost/fanstatic/foo/style.css" />
+      <script type="text/javascript"
+              src="http://localhost/fanstatic/foo/hello.js"></script>
     <base href="http://localhost/app/@@index" />
     <BLANKLINE>
     </head>
@@ -41,6 +45,7 @@
       <p>Your Grok application is up and running.
       Edit <code>${package}/app_templates/index.pt</code> to change
       this page.</p>
+      <img src="http://localhost/fanstatic/foo/evencaveman.jpg" />
     </body>
     </html>
     <BLANKLINE>

Modified: grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/tests.py_tmpl
===================================================================
--- grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/tests.py_tmpl	2010-12-03 15:50:05 UTC (rev 118681)
+++ grokproject/branches/janjaapdriessen-hurry.resource/grokproject/template/src/+package+/tests.py_tmpl	2010-12-03 15:55:51 UTC (rev 118682)
@@ -1,10 +1,15 @@
 import os.path
 import z3c.testsetup
 from zope.app.wsgi.testlayer import BrowserLayer
+import fanstatic
 
 import ${package}
 
-browser_layer = BrowserLayer(${package})
+class FanstaticLayer(BrowserLayer):
+    def setup_middleware(self, app):
+        return fanstatic.Fanstatic(app)
 
+browser_layer = FanstaticLayer(${package})
+
 test_suite = z3c.testsetup.register_all_tests(
     '${package}', globs={'getRootFolder': browser_layer.getRootFolder})

Modified: grokproject/branches/janjaapdriessen-hurry.resource/grokproject/templates.py
===================================================================
--- grokproject/branches/janjaapdriessen-hurry.resource/grokproject/templates.py	2010-12-03 15:50:05 UTC (rev 118681)
+++ grokproject/branches/janjaapdriessen-hurry.resource/grokproject/templates.py	2010-12-03 15:55:51 UTC (rev 118682)
@@ -72,6 +72,7 @@
             # Escape values that go in site.zcml.
             vars[var_name] = xml.sax.saxutils.quoteattr(vars[var_name])
         vars['app_class_name'] = vars['project'].capitalize()
+        vars['project_lowercase'] = vars['project'].lower()
 
         # Handling the version.cfg file.
         version_url = vars.get('version_url')

Modified: grokproject/branches/janjaapdriessen-hurry.resource/tests_paste.txt
===================================================================
--- grokproject/branches/janjaapdriessen-hurry.resource/tests_paste.txt	2010-12-03 15:50:05 UTC (rev 118681)
+++ grokproject/branches/janjaapdriessen-hurry.resource/tests_paste.txt	2010-12-03 15:55:51 UTC (rev 118682)
@@ -32,16 +32,19 @@
     Generated interpreter '...python-console'.
     Installing daemon.
     Generated script '...daemon'.
-    Installing debug_ini.
-    Installing deploy_ini.
+    Installing site_zcml.
+    Installing zope_conf_debug.
+    ...
+    Installing paster_ini_debug.
+    Installing zope_conf_deploy.
+    ...
+    Installing paster_ini_deploy.
     Installing i18n.
     i18n: setting up i18n tools
     Generated script '...i18nextract'.
     Generated script '...i18nmergeall'.
     Generated script '...i18nstats'.
     Generated script '...i18ncompile'.
-    Installing site_zcml.
-    Installing zope_conf.
     Installing mkdirs.
     mkdirs: created path: ...var
     mkdirs: created path: ...filestorage
@@ -71,13 +74,13 @@
     [buildout]
     extends = http://grok.zope.org/releaseinfo/1.2b/versions.cfg
     extends-cache = extends-cache
-    find-links =
     include-site-packages = false
     develop = .
     ...
 
     >>> ls(package_dir)
     .installed.cfg
+    .mr.developer.cfg
     bin
     bootstrap.py
     buildout.cfg
@@ -96,8 +99,10 @@
     app.py
     app.txt
     app_templates
+    browser
     configure.zcml
     ftesting.zcml
+    resource.py
     static
     tests.py
 
@@ -105,6 +110,7 @@
     >>> ls(bin_dir)
     buildout
     daemon
+    develop
     i18ncompile
     i18nextract
     i18nmergeall
@@ -120,11 +126,14 @@
     debug.ini
     deploy.ini
     site.zcml
-    zope.conf
+    zope.debug.conf
+    zope.deploy.conf
 
-In the generated configuration files paths are set to local paths:
+In the generated configuration files paths are set to local paths.
+We used a projectname with uppercase letters. This is respected by
+configuration files:
 
-    >>> cat(etc_dir, 'zope.conf')
+    >>> cat(etc_dir, 'zope.debug.conf')
     # Identify the component configuration used to define the site:
     site-definition /.../GrokExample/parts/etc/site.zcml
     ...
@@ -143,15 +152,6 @@
     1cd99c06b44977edcb9281133f31007b
     f74256c0d403a6bb45c38b9ce42c783c
 
-We used a projectname with uppercase letters. This is respected by
-configuration files:
-
-    >>> zope_conf = os.path.join(package_dir, 'parts', 'etc', 'zope.conf')
-    >>> print open(zope_conf, 'rb').read()
-    # Identify the component configuration used to define the site:
-    site-definition ...GrokExample/parts/etc/site.zcml
-    ...
-
 The password given is stored SSHA encoded:
 
     >>> site_zcml_in = os.path.join(package_dir, 'etc',
@@ -266,13 +266,13 @@
     >>> print 'Test:\n' + output
     Test...
     Running tests at level 1
-    Running grokexample.BrowserLayer tests:
-      Set up grokexample.BrowserLayer in ... seconds.
+    Running grokexample.FanstaticLayer tests:
+      Set up grokexample.FanstaticLayer in ... seconds.
       Running:
     ...
       Ran 3 tests with 0 failures and 0 errors in ... seconds.
     Tearing down left over layers:
-      Tear down grokexample.BrowserLayer in ... seconds.
+      Tear down grokexample.FanstaticLayer in ... seconds.
     <BLANKLINE>
 
 Using the generated `buildout` script
@@ -285,16 +285,19 @@
     >>> cd(package_dir)
     >>> cmd = os.path.join(bin_dir, 'buildout')
     >>> output = read_sh(cmd)
-    >>> print output
+    >>> print 'Test\n', output
+    Test
+    ...
     Develop: ...
     Updating app.
     Updating daemon.
-    Updating debug_ini.
-    Updating deploy_ini.
+    Updating site_zcml.
+    Updating zope_conf_debug.
+    Updating paster_ini_debug.
+    Updating zope_conf_deploy.
+    Updating paster_ini_deploy.
     Updating i18n.
     i18n: setting up i18n tools
-    Updating site_zcml.
-    Updating zope_conf.
     Updating mkdirs.
     Updating test.
     Updating zpasswd.



More information about the checkins mailing list