mirror of
https://github.com/mitmproxy/mitmproxy.git
synced 2024-11-23 05:09:57 +00:00
test dumpfiles: .bin -> .mitm
This commit is contained in:
parent
9af41b7f72
commit
faeb9678f1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,4 @@
|
||||
mitmproxy/tools/web/static/**/* -diff linguist-vendored
|
||||
web/src/js/filt/filt.js -diff
|
||||
*.bin binary
|
||||
*.mitm binary
|
||||
|
@ -120,7 +120,7 @@ async def test_start_stop(tdata):
|
||||
def test_load(tdata):
|
||||
cp = ClientPlayback()
|
||||
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
|
||||
|
||||
with pytest.raises(CommandError):
|
||||
@ -132,7 +132,7 @@ def test_configure(tdata):
|
||||
cp = ClientPlayback()
|
||||
with taddons.context(cp) as tctx:
|
||||
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
|
||||
tctx.configure(cp, client_replay=[])
|
||||
with pytest.raises(OptionsError):
|
||||
|
@ -4,21 +4,21 @@ from mitmproxy import io
|
||||
from mitmproxy import exceptions
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dumpfile, url", [
|
||||
["dumpfile-011.bin", "https://example.com/"],
|
||||
["dumpfile-018.bin", "https://www.example.com/"],
|
||||
["dumpfile-019.bin", "https://webrv.rtb-seller.com/"],
|
||||
@pytest.mark.parametrize("dumpfile, url, count", [
|
||||
["dumpfile-011.mitm", "https://example.com/", 1],
|
||||
["dumpfile-018.mitm", "https://www.example.com/", 1],
|
||||
["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:
|
||||
flow_reader = io.FlowReader(f)
|
||||
flows = list(flow_reader.stream())
|
||||
assert len(flows) == 1
|
||||
assert flows[0].request.url.startswith(url)
|
||||
assert len(flows) == count
|
||||
assert flows[-1].request.url.startswith(url)
|
||||
|
||||
|
||||
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)
|
||||
with pytest.raises(exceptions.FlowReadException):
|
||||
list(flow_reader.stream())
|
||||
|
@ -40,6 +40,6 @@ def console(monkeypatch):
|
||||
|
||||
|
||||
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("<space><tab><tab>") # view second flow
|
||||
|
Loading…
Reference in New Issue
Block a user