summaryrefslogtreecommitdiff
path: root/tests/test_fileapp.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-07-17 16:10:58 +0000
committerianb <devnull@localhost>2006-07-17 16:10:58 +0000
commit30af1b988a14b2d73354301142274510e86d57d7 (patch)
treea66ea97012fd09082a9c2446befba613a2b4566e /tests/test_fileapp.py
parentd959df3d5b7eb6c0efcbcc484823ee08628b4b0c (diff)
downloadpaste-30af1b988a14b2d73354301142274510e86d57d7.tar.gz
Added tests for file-related conditional requests. Added support for If-None-Match to DataApp. Added parsing support for multi-value headers.
Diffstat (limited to 'tests/test_fileapp.py')
-rw-r--r--tests/test_fileapp.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_fileapp.py b/tests/test_fileapp.py
index 039e2be..ef6e366 100644
--- a/tests/test_fileapp.py
+++ b/tests/test_fileapp.py
@@ -174,3 +174,24 @@ def test_file_range():
finally:
import os
os.unlink(tempfile)
+
+def test_file_cache():
+ from paste import fileapp
+ filename = os.path.join(os.path.dirname(__file__),
+ 'urlparser_data', 'secured.txt')
+ app = TestApp(fileapp.FileApp(filename))
+ res = app.get('/')
+ etag = res.header('ETag')
+ last_mod = res.header('Last-Modified')
+ res = app.get('/', headers={'If-Modified-Since': last_mod},
+ status=304)
+ res = app.get('/', headers={'If-None-Match': etag},
+ status=304)
+ res = app.get('/', headers={'If-None-Match': 'asdf'},
+ status=200)
+ res = app.get('/', headers={'If-Modified-Since': 'Sat, 1 Jan 2005 12:00:00 GMT'},
+ status=200)
+ res = app.get('/', headers={'If-Modified-Since': last_mod + '; length=100'},
+ status=304)
+ res = app.get('/', headers={'If-Modified-Since': 'invalid date'},
+ status=400)