summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDobes Vandermeer <dvandermeer@roovy.com>2014-03-06 21:29:52 -0800
committerMichael Merickel <michael@merickel.org>2014-05-16 21:42:02 -0500
commitc8a58abb1ed5705defb7d7464e4f0d086fe13a21 (patch)
tree913f547a512a566938e8abcb7debd92c7cf04ada
parent4823d8577f3dd09f908ed8e4381b4050400022db (diff)
downloadpyramid-c8a58abb1ed5705defb7d7464e4f0d086fe13a21.tar.gz
pyramid-c8a58abb1ed5705defb7d7464e4f0d086fe13a21.tar.bz2
pyramid-c8a58abb1ed5705defb7d7464e4f0d086fe13a21.zip
Expand tests - make sure pdf, jpeg types also are not annotated with a charset.
-rw-r--r--pyramid/tests/fixtures/minimal.jpgbin0 -> 631 bytes
-rw-r--r--pyramid/tests/test_response.py16
2 files changed, 13 insertions, 3 deletions
diff --git a/pyramid/tests/fixtures/minimal.jpg b/pyramid/tests/fixtures/minimal.jpg
new file mode 100644
index 000000000..1cda9a53d
--- /dev/null
+++ b/pyramid/tests/fixtures/minimal.jpg
Binary files differ
diff --git a/pyramid/tests/test_response.py b/pyramid/tests/test_response.py
index afd354d97..8061ecac5 100644
--- a/pyramid/tests/test_response.py
+++ b/pyramid/tests/test_response.py
@@ -27,17 +27,27 @@ class TestFileResponse(unittest.TestCase):
here = os.path.dirname(__file__)
return os.path.join(here, 'fixtures', 'minimal.%s'%(suffix,))
- def test_with_content_type(self):
- path = self._getPath()
+ def test_with_image_content_type(self):
+ path = self._getPath('jpg')
r = self._makeOne(path, content_type='image/jpeg')
self.assertEqual(r.content_type, 'image/jpeg')
- self.assertEqual(r.headers.get('content-type'), 'image/jpeg')
+ self.assertEqual(r.headers['content-type'], 'image/jpeg')
path = self._getPath()
+
+ def test_with_xml_content_type(self):
+ path = self._getPath('xml')
r = self._makeOne(path, content_type='application/xml')
self.assertEqual(r.content_type, 'application/xml')
self.assertEqual(r.headers['content-type'], 'application/xml; charset=UTF-8')
r.app_iter.close()
+ def test_with_pdf_content_type(self):
+ path = self._getPath('xml')
+ r = self._makeOne(path, content_type='application/pdf')
+ self.assertEqual(r.content_type, 'application/pdf')
+ self.assertEqual(r.headers['content-type'], 'application/pdf')
+ r.app_iter.close()
+
def test_without_content_type(self):
for suffix, content_type in (
('txt', 'text/plain; charset=UTF-8'),