From 30af1b988a14b2d73354301142274510e86d57d7 Mon Sep 17 00:00:00 2001 From: ianb Date: Mon, 17 Jul 2006 16:10:58 +0000 Subject: Added tests for file-related conditional requests. Added support for If-None-Match to DataApp. Added parsing support for multi-value headers. --- tests/test_fileapp.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/test_fileapp.py') 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) -- cgit v1.2.1