diff options
| author | Bert JW Regeer <bertjw@regeer.org> | 2016-07-29 22:19:39 -0600 |
|---|---|---|
| committer | Bert JW Regeer <bertjw@regeer.org> | 2016-07-29 22:19:39 -0600 |
| commit | 160326a76e0742e01e4fb7f1f73e977b1df12c11 (patch) | |
| tree | dd33b0e4f392fc16e1e3ce1419dc6b9ef55e3291 /tests | |
| parent | b8f11bf98739b61dc6d790b9e3e9da375b3b1732 (diff) | |
| download | webob-160326a76e0742e01e4fb7f1f73e977b1df12c11.tar.gz | |
Add new tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_request.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_request.py b/tests/test_request.py index 87e8b81..54eef17 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -3278,6 +3278,39 @@ class TestRequest_functional(object): assert list(res.headers.items()) == [('Content-Type', 'text/plain; charset=UTF-8')] assert res.body == b'Hi!' + def test_call_WSGI_app_204(self): + req = self._blankOne('/') + def wsgi_app(environ, start_response): + start_response('204 No Content', []) + return [b''] + assert req.call_application(wsgi_app) == ('204 No Content', [], [b'']) + + res = req.get_response(wsgi_app) + from webob.response import Response + assert isinstance(res, Response) + assert res.status == '204 No Content' + from webob.headers import ResponseHeaders + assert isinstance(res.headers, ResponseHeaders) + assert list(res.headers.items()) == [] + assert res.body == b'' + + def test_call_WSGI_app_no_content_type(self): + req = self._blankOne('/') + def wsgi_app(environ, start_response): + start_response('200 OK', []) + return [b''] + assert req.call_application(wsgi_app) == ('200 OK', [], [b'']) + + res = req.get_response(wsgi_app) + from webob.response import Response + assert isinstance(res, Response) + assert res.status == '200 OK' + assert res.content_type is None + from webob.headers import ResponseHeaders + assert isinstance(res.headers, ResponseHeaders) + assert list(res.headers.items()) == [] + assert res.body == b'' + def test_get_response_catch_exc_info_true(self): req = self._blankOne('/') def wsgi_app(environ, start_response): |
