aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/test_flow.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2017-02-06 17:48:44 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-02-08 20:04:07 +0100
commit7a9d40817ce0a97317b7940f7da2bb64da02eb51 (patch)
tree10447e8bf5d9ca3a53c03ed48a371662dfc52218 /test/mitmproxy/test_flow.py
parent28c0596742674dd59df317a91389f3826b7d5e66 (diff)
downloadmitmproxy-7a9d40817ce0a97317b7940f7da2bb64da02eb51.tar.gz
mitmproxy-7a9d40817ce0a97317b7940f7da2bb64da02eb51.tar.bz2
mitmproxy-7a9d40817ce0a97317b7940f7da2bb64da02eb51.zip
pytest.raises: shim new API
Diffstat (limited to 'test/mitmproxy/test_flow.py')
-rw-r--r--test/mitmproxy/test_flow.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py
index f546d61b..3b5d0ac1 100644
--- a/test/mitmproxy/test_flow.py
+++ b/test/mitmproxy/test_flow.py
@@ -251,9 +251,8 @@ class TestSerialize:
sio.write(b"bogus")
sio.seek(0)
r = mitmproxy.io.FlowReader(sio)
- with pytest.raises(FlowReadException) as exc_info:
+ with pytest.raises(FlowReadException, match='Invalid data format'):
list(r.stream())
- assert exc_info.match('Invalid data format')
sio = io.BytesIO()
f = tflow.tdummyflow()
@@ -261,9 +260,8 @@ class TestSerialize:
w.add(f)
sio.seek(0)
r = mitmproxy.io.FlowReader(sio)
- with pytest.raises(FlowReadException) as exc_info:
+ with pytest.raises(FlowReadException, match='Unknown flow type'):
list(r.stream())
- assert exc_info.match('Unknown flow type')
f = FlowReadException("foo")
assert str(f) == "foo"
@@ -277,7 +275,7 @@ class TestSerialize:
sio.seek(0)
r = mitmproxy.io.FlowReader(sio)
- with pytest.raises("version"):
+ with pytest.raises(Exception, match="version"):
list(r.stream())
@@ -287,15 +285,15 @@ class TestFlowMaster:
fm = master.Master(None, DummyServer())
f = tflow.tflow(resp=True)
f.request.content = None
- with pytest.raises("missing"):
+ with pytest.raises(Exception, match="missing"):
fm.replay_request(f)
f.intercepted = True
- with pytest.raises("intercepted"):
+ with pytest.raises(Exception, match="intercepted"):
fm.replay_request(f)
f.live = True
- with pytest.raises("live"):
+ with pytest.raises(Exception, match="live"):
fm.replay_request(f)
def test_create_flow(self):