changeset 31:f00fcf6d9f1d

test not modified response
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 05 Mar 2012 13:49:07 -0800
parents 52103702a732
children 0edb831061f5
files tests/test.py tests/test_fileapp.txt
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test.py	Mon Mar 05 13:40:15 2012 -0800
+++ b/tests/test.py	Mon Mar 05 13:49:07 2012 -0800
@@ -17,9 +17,10 @@
     # doctest arguments
     directory = os.path.dirname(os.path.abspath(__file__))
     extraglobs = {'here': directory}
-    doctest_args = dict(extraglobs=extraglobs, raise_on_error=raise_on_error)
+    doctest_args = dict(extraglobs=extraglobs, raise_on_error=raise_on_error, )
+    doctest_args['optionflags'] = doctest.ELLIPSIS
     if report_first:
-        doctest_args['optionflags'] = doctest.REPORT_ONLY_FIRST_FAILURE
+        doctest_args['optionflags'] |= doctest.REPORT_ONLY_FIRST_FAILURE
 
     # gather tests
     tests =  [test for test in os.listdir(directory)
--- a/tests/test_fileapp.txt	Mon Mar 05 13:40:15 2012 -0800
+++ b/tests/test_fileapp.txt	Mon Mar 05 13:49:07 2012 -0800
@@ -29,7 +29,7 @@
     6L
     >>> req = Request.blank('/')
     >>> res = req.get_response(app)
-    >>> print res # doctest:+ELLIPSIS
+    >>> print res 
     200 OK
     Content-Type: text/plain; charset=UTF-8
     Content-Length: 6
@@ -38,3 +38,11 @@
     <BLANKLINE>
     hello
     <BLANKLINE>
+    >>> req2 = Request.blank('/')
+    >>> req2.if_none_match = res.etag
+    >>> req2.get_response(app)
+    <Response ... 304 Not Modified>
+    >>> req3 = Request.blank('/')
+    >>> req3.if_modified_since = res.last_modified
+    >>> req3.get_response(app)
+    <Response ... 304 Not Modified>