diff options
author | Marc Abramowitz <marc@marc-abramowitz.com> | 2016-03-07 14:05:52 -0800 |
---|---|---|
committer | Marc Abramowitz <marc@marc-abramowitz.com> | 2016-03-07 14:05:52 -0800 |
commit | 42b22881290e00e06b840dee1e42f0f5ef044d47 (patch) | |
tree | b4fef928625acd3e8ee45ccaa8c7a6c9810b3601 /tests/test_gzipper.py | |
download | paste-git-tox_add_py35.tar.gz |
tox.ini: Add py35 to envlisttox_add_py35
Diffstat (limited to 'tests/test_gzipper.py')
-rw-r--r-- | tests/test_gzipper.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_gzipper.py b/tests/test_gzipper.py new file mode 100644 index 0000000..54b7901 --- /dev/null +++ b/tests/test_gzipper.py @@ -0,0 +1,19 @@ +from paste.fixture import TestApp +from paste.gzipper import middleware +import gzip +import six + +def simple_app(environ, start_response): + start_response('200 OK', [('content-type', 'text/plain')]) + return [b'this is a test'] + +wsgi_app = middleware(simple_app) +app = TestApp(wsgi_app) + +def test_gzip(): + res = app.get( + '/', extra_environ=dict(HTTP_ACCEPT_ENCODING='gzip')) + assert int(res.header('content-length')) == len(res.body) + assert res.body != b'this is a test' + actual = gzip.GzipFile(fileobj=six.BytesIO(res.body)).read() + assert actual == b'this is a test' |