mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 14:58:38 +00:00
move encoding tests from mitmproxy to netlib
This commit is contained in:
parent
0be84fd6b9
commit
1c12e7c2b8
32
test/test_encoding.py
Normal file
32
test/test_encoding.py
Normal file
@ -0,0 +1,32 @@
|
||||
from netlib import encoding
|
||||
|
||||
def test_identity():
|
||||
assert "string" == encoding.decode("identity", "string")
|
||||
assert "string" == encoding.encode("identity", "string")
|
||||
assert not encoding.encode("nonexistent", "string")
|
||||
assert None == encoding.decode("nonexistent encoding", "string")
|
||||
|
||||
|
||||
def test_gzip():
|
||||
assert "string" == encoding.decode(
|
||||
"gzip",
|
||||
encoding.encode(
|
||||
"gzip",
|
||||
"string"))
|
||||
assert None == encoding.decode("gzip", "bogus")
|
||||
|
||||
|
||||
def test_deflate():
|
||||
assert "string" == encoding.decode(
|
||||
"deflate",
|
||||
encoding.encode(
|
||||
"deflate",
|
||||
"string"))
|
||||
assert "string" == encoding.decode(
|
||||
"deflate",
|
||||
encoding.encode(
|
||||
"deflate",
|
||||
"string")[
|
||||
2:-
|
||||
4])
|
||||
assert None == encoding.decode("deflate", "bogus")
|
Loading…
Reference in New Issue
Block a user