mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
a817db5bd6
Also fix the unit tests I forgot to commit...
31 lines
947 B
Python
31 lines
947 B
Python
from libmproxy import encoding
|
|
import libpry
|
|
|
|
import cStringIO
|
|
import gzip, zlib
|
|
|
|
class uidentity(libpry.AutoTree):
|
|
def test_simple(self):
|
|
assert "string" == encoding.decode("identity", "string")
|
|
assert "string" == encoding.encode("identity", "string")
|
|
|
|
def test_fallthrough(self):
|
|
assert None == encoding.decode("nonexistent encoding", "string")
|
|
|
|
class ugzip(libpry.AutoTree):
|
|
def test_simple(self):
|
|
assert "string" == encoding.decode("gzip", encoding.encode("gzip", "string"))
|
|
assert None == encoding.decode("gzip", "bogus")
|
|
|
|
class udeflate(libpry.AutoTree):
|
|
def test_simple(self):
|
|
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")
|
|
|
|
tests = [
|
|
uidentity(),
|
|
ugzip(),
|
|
udeflate()
|
|
]
|