Commits

Danny Navarro committed 8570193

test response instantiation when content type in header list

Comments (0)

Files changed (1)

tests/test_response.py

     resp2 = Response.from_file(input)
     eq_(resp.body, resp2.body)
     eq_(resp.headers, resp2.headers)
+
+def test_content_type_in_headerlist():
+    # Couldn't manage to clone Response in order to modify class
+    # attributes safely. Shouldn't classes be fresh imported for every
+    # test?
+    default_content_type = Response.default_content_type
+    Response.default_content_type = None
+    try:
+        res = Response(headerlist=[('Content-Type', 'text/html')],
+                            charset='utf8')
+        ok_(res._headerlist)
+        eq_(res.charset, 'utf8')
+    finally:
+        Response.default_content_type = default_content_type
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.