test dumpfiles: .bin -> .mitm
This commit is contained in:
parent
9af41b7f72
commit
faeb9678f1
|
@ -1,3 +1,4 @@
|
||||||
mitmproxy/tools/web/static/**/* -diff linguist-vendored
|
mitmproxy/tools/web/static/**/* -diff linguist-vendored
|
||||||
web/src/js/filt/filt.js -diff
|
web/src/js/filt/filt.js -diff
|
||||||
*.bin binary
|
*.bin binary
|
||||||
|
*.mitm binary
|
||||||
|
|
|
@ -120,7 +120,7 @@ async def test_start_stop(tdata):
|
||||||
def test_load(tdata):
|
def test_load(tdata):
|
||||||
cp = ClientPlayback()
|
cp = ClientPlayback()
|
||||||
with taddons.context(cp):
|
with taddons.context(cp):
|
||||||
cp.load_file(tdata.path("mitmproxy/data/dumpfile-018.bin"))
|
cp.load_file(tdata.path("mitmproxy/data/dumpfile-018.mitm"))
|
||||||
assert cp.count() == 1
|
assert cp.count() == 1
|
||||||
|
|
||||||
with pytest.raises(CommandError):
|
with pytest.raises(CommandError):
|
||||||
|
@ -132,7 +132,7 @@ def test_configure(tdata):
|
||||||
cp = ClientPlayback()
|
cp = ClientPlayback()
|
||||||
with taddons.context(cp) as tctx:
|
with taddons.context(cp) as tctx:
|
||||||
assert cp.count() == 0
|
assert cp.count() == 0
|
||||||
tctx.configure(cp, client_replay=[tdata.path("mitmproxy/data/dumpfile-018.bin")])
|
tctx.configure(cp, client_replay=[tdata.path("mitmproxy/data/dumpfile-018.mitm")])
|
||||||
assert cp.count() == 1
|
assert cp.count() == 1
|
||||||
tctx.configure(cp, client_replay=[])
|
tctx.configure(cp, client_replay=[])
|
||||||
with pytest.raises(OptionsError):
|
with pytest.raises(OptionsError):
|
||||||
|
|
|
@ -4,21 +4,21 @@ from mitmproxy import io
|
||||||
from mitmproxy import exceptions
|
from mitmproxy import exceptions
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("dumpfile, url", [
|
@pytest.mark.parametrize("dumpfile, url, count", [
|
||||||
["dumpfile-011.bin", "https://example.com/"],
|
["dumpfile-011.mitm", "https://example.com/", 1],
|
||||||
["dumpfile-018.bin", "https://www.example.com/"],
|
["dumpfile-018.mitm", "https://www.example.com/", 1],
|
||||||
["dumpfile-019.bin", "https://webrv.rtb-seller.com/"],
|
["dumpfile-019.mitm", "https://webrv.rtb-seller.com/", 1],
|
||||||
])
|
])
|
||||||
def test_load(tdata, dumpfile, url):
|
def test_load(tdata, dumpfile, url, count):
|
||||||
with open(tdata.path("mitmproxy/data/" + dumpfile), "rb") as f:
|
with open(tdata.path("mitmproxy/data/" + dumpfile), "rb") as f:
|
||||||
flow_reader = io.FlowReader(f)
|
flow_reader = io.FlowReader(f)
|
||||||
flows = list(flow_reader.stream())
|
flows = list(flow_reader.stream())
|
||||||
assert len(flows) == 1
|
assert len(flows) == count
|
||||||
assert flows[0].request.url.startswith(url)
|
assert flows[-1].request.url.startswith(url)
|
||||||
|
|
||||||
|
|
||||||
def test_cannot_convert(tdata):
|
def test_cannot_convert(tdata):
|
||||||
with open(tdata.path("mitmproxy/data/dumpfile-010.bin"), "rb") as f:
|
with open(tdata.path("mitmproxy/data/dumpfile-010.mitm"), "rb") as f:
|
||||||
flow_reader = io.FlowReader(f)
|
flow_reader = io.FlowReader(f)
|
||||||
with pytest.raises(exceptions.FlowReadException):
|
with pytest.raises(exceptions.FlowReadException):
|
||||||
list(flow_reader.stream())
|
list(flow_reader.stream())
|
||||||
|
|
|
@ -40,6 +40,6 @@ def console(monkeypatch):
|
||||||
|
|
||||||
|
|
||||||
def test_integration(tdata, console):
|
def test_integration(tdata, console):
|
||||||
console.type(f":view.flows.load {tdata.path('mitmproxy/data/dumpfile-7.bin')}<enter>")
|
console.type(f":view.flows.load {tdata.path('mitmproxy/data/dumpfile-7.mitm')}<enter>")
|
||||||
console.type("<enter><tab><tab>")
|
console.type("<enter><tab><tab>")
|
||||||
console.type("<space><tab><tab>") # view second flow
|
console.type("<space><tab><tab>") # view second flow
|
||||||
|
|
Loading…
Reference in New Issue