diff options
| author | cce <cce@localhost> | 2005-12-27 09:47:16 +0000 |
|---|---|---|
| committer | cce <cce@localhost> | 2005-12-27 09:47:16 +0000 |
| commit | eefb3f1ec91efaac2fc0333467eb8fdac55c4e71 (patch) | |
| tree | 3e1f69f17feef35cc9f455ca768d0f5d0d7ee1f5 /tests/test_httpheaders.py | |
| parent | a3ed67f219c2f87ab8ae0a27f43fc77fb321e6f3 (diff) | |
| download | paste-git-eefb3f1ec91efaac2fc0333467eb8fdac55c4e71.tar.gz | |
major re-work of httpheaders
Diffstat (limited to 'tests/test_httpheaders.py')
| -rw-r--r-- | tests/test_httpheaders.py | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/tests/test_httpheaders.py b/tests/test_httpheaders.py index 7623c78..9db1396 100644 --- a/tests/test_httpheaders.py +++ b/tests/test_httpheaders.py @@ -1,34 +1,31 @@ from paste.httpheaders import * +def test_environ(): + environ = {'HTTP_VIA':'bing', 'wsgi.version': '1.0' } + assert 'bing' == Via(environ) + +def test_response_headers(): + response_headers = [('via', 'bing')] + assert 'bing' == Via(response_headers) + def test_sorting(): # verify the HTTP_HEADERS are set with their canonical form - sample = [HTTP_WWW_AUTHENTICATE, HTTP_VIA, HTTP_ACCEPT, HTTP_DATE, - HTTP_ACCEPT_CHARSET, HTTP_AGE, HTTP_ALLOW, HTTP_CACHE_CONTROL, - HTTP_CONTENT_ENCODING, HTTP_ETAG, HTTP_CONTENT_TYPE, HTTP_FROM, - HTTP_EXPIRES, HTTP_RANGE, HTTP_UPGRADE, HTTP_VARY, HTTP_ALLOW] + sample = [WWWAuthenticate, Via, Accept, Date, + AcceptCharset, Age, Allow, CacheControl, + ContentEncoding, ETag, ContentType, From, + Expires, Range, Upgrade, Vary, Allow] sample.sort() - sample = [(x.category, str(x)) for x in sample] + sample = [str(x) for x in sample] assert sample == [ # general headers first - ('general', 'Cache-Control'), - ('general', 'Date'), - ('general', 'Upgrade'), - ('general', 'Via'), - # request and response - ('request', 'Accept'), - ('request', 'Accept-Charset'), - ('response', 'Age'), - ('response', 'ETag'), # ETag is odd case - ('request', 'From'), - ('request', 'Range'), - ('response', 'Vary'), - ('response', 'WWW-Authenticate'), # so is WWW-Authenticate - # entity headers last - ('entity', 'Allow'), # expected duplicate - ('entity', 'Allow'), - ('entity', 'Content-Encoding'), - ('entity', 'Content-Type'), - ('entity', 'Expires')] + 'Cache-Control', 'Date', 'Upgrade', 'Via', + # request headers next + 'Accept', 'Accept-Charset', 'From', 'Range', + # response headers following + 'Age', 'ETag', 'Vary', 'WWW-Authenticate', + # entity headers (/w expected duplicate) + 'Allow', 'Allow', 'Content-Encoding', 'Content-Type', 'Expires' + ] def test_normalize(): response_headers = [ |
