[Checkins] SVN: hurry.zoperesource/branches/janjaapdriessen-wsgi/s minimal test fixes
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Wed Nov 24 12:17:31 EST 2010
Log message for revision 118570:
minimal test fixes
Changed:
U hurry.zoperesource/branches/janjaapdriessen-wsgi/setup.py
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py
U hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py
-=-
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/setup.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/setup.py 2010-11-24 17:01:28 UTC (rev 118569)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/setup.py 2010-11-24 17:17:30 UTC (rev 118570)
@@ -31,7 +31,7 @@
zip_safe=False,
install_requires=[
'setuptools',
- 'hurry.resource[wsgi] >= 0.10',
+ 'hurry.resource[wsgi,publisher] >= 0.10',
'z3c.autoinclude',
'zope.browserresource',
'zope.component',
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt 2010-11-24 17:01:28 UTC (rev 118569)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/README.txt 2010-11-24 17:17:30 UTC (rev 118570)
@@ -4,16 +4,16 @@
This package provides Zope integration for hurry.resource. This means
it's taking care of two things:
-* provide access to the needed resources in the WSGI environment throughout
- the request/response cycle.
+* provide access to the needed resources in the WSGI environment
+ throughout the request/response cycle.
* provide the base URL for the resources to be rendered.
This library fulfills these conditions for a Zope Toolkit/Grok setup.
We'll run through a few tests to demonstrate it. Note that the real
-code being tested is not in this document itself, but in the views described
-in ``ftesting.zcml``.
+code being tested is not in this document itself, but in the views
+described in ``ftesting.zcml``.
We need to be in a request to make this work, so let's up a request to
a page we have set up in ``ftesting.zcml`` that should cause the
@@ -26,7 +26,7 @@
>>> print browser.contents
<html>
<head>
- <script type="text/javascript" src="http://localhost/@@/:hash:.../foo/a.js"></script>
+ <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/a.js"></script>
<BLANKLINE>
</head>
<body>
@@ -41,8 +41,8 @@
>>> print browser.contents
<html>
<head>
- <script type="text/javascript" src="http://localhost/@@/:hash:.../foo/a.js"></script>
- <script type="text/javascript" src="http://localhost/@@/:hash:.../foo/b.js"></script>
+ <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/a.js"></script>
+ <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/b.js"></script>
<BLANKLINE>
</head>
<body>
@@ -53,6 +53,7 @@
Let's force all javascript resources to be forced to be included at
the bottom now, just before the ``</body>`` tag::
+ >>> import hurry.resource
>>> browser.open('http://localhost/hurry.zoperesource.test_bottom')
>>> print browser.contents
<html>
@@ -60,15 +61,15 @@
</head>
<body>
<p>the widget HTML itself</p>
- <script type="text/javascript" src="http://localhost/@@/:hash:.../foo/a.js"></script>
- <script type="text/javascript" src="http://localhost/@@/:hash:.../foo/b.js"></script></body>
+ <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/a.js"></script>
+ <script type="text/javascript" src="http://localhost/fanstatic/:hash:.../foo/b.js"></script></body>
</html>
In-template resources
---------------------
-Hurry.zoperesource provides support for rendering resource publisher aware URLs
-to in-template resources::
+Hurry.zoperesource provides support for rendering resource publisher
+aware URLs to in-template resources::
>>> browser.open('http://localhost/hurry.zoperesource.test_inline_resource')
>>> print browser.contents
@@ -76,8 +77,8 @@
<head>
</head>
<body>
- <img src="http://localhost/@@/:hash:.../foo/evencaveman.jpg" />
- <img src="http://localhost/@@/:hash:.../foo/sub/evencaveman.jpg" />
+ <img src="http://localhost/fanstatic/:hash:.../foo/evencaveman.jpg" />
+ <img src="http://localhost/fanstatic/:hash:.../foo/sub/evencaveman.jpg" />
</body>
</html>
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py 2010-11-24 17:01:28 UTC (rev 118569)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/tests.py 2010-11-24 17:17:30 UTC (rev 118570)
@@ -7,7 +7,7 @@
from zope.publisher.interfaces.browser import IBrowserRequest
from hurry.resource.wsgi import InjectMiddleWare
-from hurry.zoperesource.zcml import create_resource_factory
+from hurry.zoperesource.zcml import create_factory
from hurry.zoperesource.tests.view import foo
import hurry.zoperesource.tests
@@ -15,12 +15,10 @@
def testSetUp(self):
super(HurryResourceBrowserLayer, self).testSetUp()
-
- # Because it is difficult to dynamically register a entry_point in
- # tests, we do the setup by hand:
- resource_factory = create_resource_factory(foo)
- gsm = getGlobalSiteManager()
- gsm.registerAdapter(
+ # Because it is difficult to dynamically register a
+ # entry_point in tests, we do the setup by hand:
+ resource_factory = create_factory(foo)
+ getGlobalSiteManager().registerAdapter(
resource_factory, (IBrowserRequest,), Interface, foo.name)
def setup_middleware(self, app):
Modified: hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py
===================================================================
--- hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py 2010-11-24 17:01:28 UTC (rev 118569)
+++ hurry.zoperesource/branches/janjaapdriessen-wsgi/src/hurry/zoperesource/tests/view.py 2010-11-24 17:17:30 UTC (rev 118570)
@@ -1,31 +1,30 @@
-from hurry.resource import Library, ResourceInclusion, bottom
+from hurry.resource import Library, ResourceInclusion, get_current_needed_inclusions
-
foo = Library("foo", "foo_dir")
a = ResourceInclusion(foo, "a.js")
b = ResourceInclusion(foo, "b.js", depends=[a])
-
class TestSingle(object):
def widget(self):
a.need()
return "the widget HTML itself"
-
class TestMultiple(object):
def widget(self):
b.need()
return "the widget HTML itself"
-
class TestBottom(object):
def widget(self):
b.need()
- bottom(force=True)
+ # XXX this does not use any official API and needs to be
+ # reconsidered. Its done anyway now to make the tests pass,
+ # instead of just removing the corresponding test.
+ get_current_needed_inclusions()._bottom = True
+ get_current_needed_inclusions()._force_bottom = True
return "the widget HTML itself"
-
class TestInlineResource(object):
pass
More information about the checkins
mailing list