summaryrefslogtreecommitdiff
path: root/tests/test_httpheaders.py
diff options
context:
space:
mode:
authorcce <devnull@localhost>2005-12-25 23:16:43 +0000
committercce <devnull@localhost>2005-12-25 23:16:43 +0000
commit843425bf2c3f36d7fae7ae34ffcadd7f4f9f6280 (patch)
treedad7f118dd83bfdc590ee0b70ffb3375819f505c /tests/test_httpheaders.py
parentb9e0615895518bf4a4561563950863171fc71885 (diff)
downloadpaste-843425bf2c3f36d7fae7ae34ffcadd7f4f9f6280.tar.gz
Adding httpheaders, which is similar to httpexceptions only that it
contains a full set of headers /w their corresponding category, version, and an indicator if they are single value or multi-value
Diffstat (limited to 'tests/test_httpheaders.py')
-rw-r--r--tests/test_httpheaders.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_httpheaders.py b/tests/test_httpheaders.py
new file mode 100644
index 0000000..2ac1a48
--- /dev/null
+++ b/tests/test_httpheaders.py
@@ -0,0 +1,32 @@
+from paste.httpheaders import *
+
+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.sort()
+ sample = [(x.category, 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')]
+