summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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'),