diff options
| author | Bert JW Regeer <bertjw@regeer.org> | 2016-04-12 20:13:32 -0600 |
|---|---|---|
| committer | Bert JW Regeer <bertjw@regeer.org> | 2016-04-12 20:21:53 -0600 |
| commit | 4061d5bc2a8c066e811388070033946d80eaccb7 (patch) | |
| tree | cf3771c9df5ce19eceeb15f5beae8d278a8bdc89 | |
| parent | b799e3ced5422fac7ca109e29c4fd32e08157dcf (diff) | |
| download | pyramid-4061d5bc2a8c066e811388070033946d80eaccb7.tar.gz pyramid-4061d5bc2a8c066e811388070033946d80eaccb7.tar.bz2 pyramid-4061d5bc2a8c066e811388070033946d80eaccb7.zip | |
Update tests to verif Content-Type header
| -rw-r--r-- | pyramid/tests/test_httpexceptions.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pyramid/tests/test_httpexceptions.py b/pyramid/tests/test_httpexceptions.py index 47d138d7b..a4b936a38 100644 --- a/pyramid/tests/test_httpexceptions.py +++ b/pyramid/tests/test_httpexceptions.py @@ -212,6 +212,9 @@ class TestHTTPException(unittest.TestCase): environ = _makeEnviron() start_response = DummyStartResponse() body = list(exc(environ, start_response))[0] + for header in start_response.headerlist: + if header[0] == 'Content-Type': + self.assertEqual(header[1], 'text/plain; charset=UTF-8') self.assertEqual(body, b'200 OK\n\nexplanation\n\n\n\n\n') def test__default_app_iter_with_comment_plain(self): @@ -220,14 +223,20 @@ class TestHTTPException(unittest.TestCase): environ = _makeEnviron() start_response = DummyStartResponse() body = list(exc(environ, start_response))[0] + for header in start_response.headerlist: + if header[0] == 'Content-Type': + self.assertEqual(header[1], 'text/plain; charset=UTF-8') self.assertEqual(body, b'200 OK\n\nexplanation\n\n\n\ncomment\n') - + def test__default_app_iter_no_comment_html(self): cls = self._getTargetSubclass() exc = cls() environ = _makeEnviron() start_response = DummyStartResponse() body = list(exc(environ, start_response))[0] + for header in start_response.headerlist: + if header[0] == 'Content-Type': + self.assertEqual(header[1], 'text/plain; charset=UTF-8') self.assertFalse(b'<!-- ' in body) def test__default_app_iter_with_comment_ampersand(self): @@ -237,9 +246,12 @@ class TestHTTPException(unittest.TestCase): environ['HTTP_ACCEPT'] = 'text/html' start_response = DummyStartResponse() body = list(exc(environ, start_response))[0] + for header in start_response.headerlist: + if header[0] == 'Content-Type': + self.assertEqual(header[1], 'text/html; charset=UTF-8') self.assertTrue(b'<!-- comment & comment -->' in body) - def test__default_app_iter_with_comment_html2(self): + def test__default_app_iter_with_comment_html(self): cls = self._getTargetSubclass() exc = cls(comment='comment & comment') environ = _makeEnviron() |
