mitmproxy/test/test_proxy.py

26 lines
505 B
Python
Raw Normal View History

2012-02-19 22:04:07 +00:00
import cStringIO, textwrap
from cStringIO import StringIO
2010-02-16 04:09:07 +00:00
import libpry
2012-02-19 22:04:07 +00:00
from libmproxy import proxy, flow
import tutils
2010-02-16 04:09:07 +00:00
class TestProxyError:
2010-02-16 04:09:07 +00:00
def test_simple(self):
p = proxy.ProxyError(111, "msg")
assert repr(p)
2012-06-18 22:42:55 +00:00
class TestAppRegistry:
def test_add_get(self):
ar = proxy.AppRegistry()
ar.add("foo", "domain", 80)
r = tutils.treq()
r.host = "domain"
r.port = 80
assert ar.get(r)
r.port = 81
assert not ar.get(r)