diff options
author | Aldo Cortesi <aldo@corte.si> | 2016-09-05 10:15:23 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-05 10:15:23 +1200 |
commit | c76d83f749079b88a2b7b7a76545a7d571ed96a5 (patch) | |
tree | 6e3df5338cbd413b308506bdbf6641d52aa33e2c /test/netlib/test_encoding.py | |
parent | 0483486c628d0e590231ed44bf5a3656122c543e (diff) | |
parent | c0b12da40108899d9bf470d14a460f6ca4efaa5d (diff) | |
download | mitmproxy-c76d83f749079b88a2b7b7a76545a7d571ed96a5.tar.gz mitmproxy-c76d83f749079b88a2b7b7a76545a7d571ed96a5.tar.bz2 mitmproxy-c76d83f749079b88a2b7b7a76545a7d571ed96a5.zip |
Merge pull request #1515 from Kriechi/bump-brotli
bump brotli dependency
Diffstat (limited to 'test/netlib/test_encoding.py')
-rw-r--r-- | test/netlib/test_encoding.py | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/test/netlib/test_encoding.py b/test/netlib/test_encoding.py index 08e69ec5..797abff2 100644 --- a/test/netlib/test_encoding.py +++ b/test/netlib/test_encoding.py @@ -1,4 +1,6 @@ import mock +import pytest + from netlib import encoding, tutils @@ -9,47 +11,32 @@ def test_identity(): encoding.encode(b"string", "nonexistent encoding") -def test_gzip(): - assert b"string" == encoding.decode( - encoding.encode( - b"string", - "gzip" - ), - "gzip" - ) - with tutils.raises(ValueError): - encoding.decode(b"bogus", "gzip") +@pytest.mark.parametrize("encoder", [ + 'gzip', + 'br', + 'deflate', +]) +def test_encoders(encoder): + assert "" == encoding.decode("", encoder) + assert b"" == encoding.decode(b"", encoder) - -def test_brotli(): - assert b"string" == encoding.decode( + assert "string" == encoding.decode( encoding.encode( - b"string", - "br" + "string", + encoder ), - "br" + encoder ) - with tutils.raises(ValueError): - encoding.decode(b"bogus", "br") - - -def test_deflate(): assert b"string" == encoding.decode( encoding.encode( b"string", - "deflate" + encoder ), - "deflate" - ) - assert b"string" == encoding.decode( - encoding.encode( - b"string", - "deflate" - )[2:-4], - "deflate" + encoder ) + with tutils.raises(ValueError): - encoding.decode(b"bogus", "deflate") + encoding.decode(b"foobar", encoder) def test_cache(): |