[Checkins] SVN: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt Added some missing tests of the examples.
Jim Fulton
jim at zope.com
Thu Jun 11 06:22:53 EDT 2009
Log message for revision 100859:
Added some missing tests of the examples.
Changed:
U bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt
-=-
Modified: bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt
===================================================================
--- bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt 2009-06-11 10:00:10 UTC (rev 100858)
+++ bobo/trunk/bobodoctestumentation/src/bobodoctestumentation/more.txt 2009-06-11 10:22:53 UTC (rev 100859)
@@ -232,8 +232,6 @@
... src = src.replace("\n at bobo.scan_class", "")
... src += "\nbobo.scan_class(Document)"
-
-
>>> update_module('docs', src)
We use the ``bobo_resources`` option to control the URLs we access these
@@ -373,6 +371,18 @@
>> app.get(url6, status=200).body == expected6
True
+.. check base and index
+
+ >>> url7 = 'http://localhost:8080/docs/bobs'
+ >>> url8 = 'http://localhost:8080/docs/bobs/'
+
+ >>> app.get(url7, status=302).headers['location']
+ 'http://localhost:8080/docs/bobs/'
+ >>> print app.get(url8, status=200).body,
+ <a href="hi.html">hi.html<a><br>
+ <a href="hobbies">hobbies<a><br>
+
+
Configuring routes in python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -422,6 +432,12 @@
>>> app.get('http://localhost:8080/xxx.html', status=200).body == 'xxx'
True
+ >>> app.get(url7, status=302).headers['location']
+ 'http://localhost:8080/docs/bobs/'
+ >>> print app.get(url8, status=200).body,
+ <a href="hi.html">hi.html<a><br>
+ <a href="hobbies">hobbies<a><br>
+
The ``resources`` function takes an iterable of resources, where the
resources can be resource objects, or strings naming resource objects
or modules.
@@ -493,6 +509,12 @@
True
>>> _ = app.get('http://localhost:8080/xxx', status=404)
+ >>> app.get(url7, status=302).headers['location']
+ 'http://localhost:8080/docs/bobs/'
+ >>> print app.get(url8, status=200).body,
+ <a href="hi.html">hi.html<a><br>
+ <a href="hobbies">hobbies<a><br>
+
Here, rather than adding a new resource to the module, we've copied the
``bobo_response`` method from a new resource to the module, making
the module a resource. When bobo scans a module, it first checks
More information about the Checkins
mailing list