summaryrefslogtreecommitdiff
path: root/tests/test_request.py
diff options
context:
space:
mode:
authorbbangert <devnull@localhost>2007-01-31 22:33:30 +0000
committerbbangert <devnull@localhost>2007-01-31 22:33:30 +0000
commitafa02337bac78d6a37e59866efebb075ed72114a (patch)
treeedd6a0e4a2ac0ff0e3fadd7dea0c8631bf37cf04 /tests/test_request.py
parentd4b707763246138d461560277743c2f3562c1abc (diff)
downloadpaste-afa02337bac78d6a37e59866efebb075ed72114a.tar.gz
Added WSGIRequest.mimetypes property and unit tests for it.
Diffstat (limited to 'tests/test_request.py')
-rw-r--r--tests/test_request.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test_request.py b/tests/test_request.py
index cb2a7ca..e40ac8c 100644
--- a/tests/test_request.py
+++ b/tests/test_request.py
@@ -11,9 +11,11 @@ def simpleapp(environ, start_response):
response_headers = [('Content-type','text/plain')]
start_response(status, response_headers)
request = WSGIRequest(environ)
+ WSGIRequest.defaults['mimetypes'] = ['text/html', 'application/xml']
return ['Hello world!\n', 'The get is %s' % str(request.GET),
' and Val is %s' % request.GET.get('name'),
- 'The languages are: %s' % request.languages]
+ 'The languages are: %s' % request.languages,
+ 'The mimetype is: %s' % request.mimetypes]
def test_gets():
app = TestApp(simpleapp)
@@ -35,4 +37,14 @@ def test_language_parsing():
res = app.get('/', headers={'Accept-Language':'en-gb;q=0.8, da, en;q=0.7'})
assert "languages are: ['da', 'en-gb', 'en', 'en-us']" in res
- \ No newline at end of file
+
+def test_mime_parsing():
+ app = TestApp(simpleapp)
+ res = app.get('/', headers={'Accept':'text/html'})
+ assert "mimetype is: ['text/html']" in res
+
+ res = app.get('/', headers={'Accept':'application/xml'})
+ assert "mimetype is: ['application/xml']" in res
+
+ res = app.get('/', headers={'Accept':'application/xml,*/*'})
+ assert "mimetype is: ['text/html', 'application/xml']" in res