mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-01-12 22:48:54 +08:00
fix merge
This commit is contained in:
@@ -115,13 +115,14 @@ def tflow(client_conn=True, server_conn=True, req=True, resp=None, err=None):
|
||||
return f
|
||||
|
||||
|
||||
class DummyFlow(flow.Flow):
|
||||
"""A flow that is neither HTTP nor TCP."""
|
||||
|
||||
def __init__(self, client_conn, server_conn, live=None):
|
||||
super().__init__("dummy", client_conn, server_conn, live)
|
||||
|
||||
|
||||
def tdummyflow(client_conn=True, server_conn=True, err=None):
|
||||
class DummyFlow(flow.Flow):
|
||||
"""A flow that is neither HTTP nor TCP."""
|
||||
|
||||
def __init__(self, client_conn, server_conn, live=None):
|
||||
super().__init__("dummy", client_conn, server_conn, live)
|
||||
|
||||
if client_conn is True:
|
||||
client_conn = tclient_conn()
|
||||
if server_conn is True:
|
||||
|
||||
@@ -29,8 +29,8 @@ skip_appveyor = pytest.mark.skipif(
|
||||
original_pytest_raises = pytest.raises
|
||||
|
||||
|
||||
@functools.wraps(original_pytest_raises)
|
||||
def raises(exc, *args, **kwargs):
|
||||
functools.wraps(original_pytest_raises)
|
||||
if isinstance(exc, str):
|
||||
return RaisesContext(exc)
|
||||
else:
|
||||
|
||||
@@ -172,9 +172,9 @@ def test_reversed():
|
||||
assert v[-1].request.timestamp_start == 1
|
||||
assert v[2].request.timestamp_start == 1
|
||||
with pytest.raises(IndexError):
|
||||
v.__getitem__(5)
|
||||
v[5]
|
||||
with pytest.raises(IndexError):
|
||||
v.__getitem__(-5)
|
||||
v[-5]
|
||||
|
||||
assert v._bisect(v[0]) == 1
|
||||
assert v._bisect(v[2]) == 3
|
||||
@@ -368,14 +368,14 @@ def test_settings():
|
||||
f = tft()
|
||||
|
||||
with pytest.raises(KeyError):
|
||||
v.settings.__getitem__(f)
|
||||
v.settings[f]
|
||||
v.add(f)
|
||||
v.settings[f]["foo"] = "bar"
|
||||
assert v.settings[f]["foo"] == "bar"
|
||||
assert len(list(v.settings)) == 1
|
||||
v.remove(f)
|
||||
with pytest.raises(KeyError):
|
||||
v.settings.__getitem__(f)
|
||||
v.settings[f]
|
||||
assert not v.settings.keys()
|
||||
|
||||
v.add(f)
|
||||
|
||||
Reference in New Issue
Block a user