MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_edit

Function test_edit

test/mitmproxy/tools/console/test_flowview.py:21–37  ·  view source on GitHub ↗
(console, monkeypatch, caplog)

Source from the content-addressed store, hash-verified

19
20
21async def test_edit(console, monkeypatch, caplog):
22 MSGPACK_WITH_TRUE = b"\x81\xa5hello\xc3"
23 MSGPACK_WITH_FALSE = b"\x81\xa5hello\xc2"
24 f = tflow.tflow(
25 req=http.Request.make(
26 "POST",
27 "http://example.com",
28 MSGPACK_WITH_TRUE,
29 headers={"Content-Type": "application/msgpack"},
30 )
31 )
32 await console.load_flow(f)
33 monkeypatch.setattr(console, "spawn_editor", _edit)
34
35 console.type(':console.edit.focus "request-body (MsgPack)"<enter><enter>')
36 assert "hello: false" in console.screen_contents()
37 assert f.request.content == MSGPACK_WITH_FALSE
38
39
40async def test_content_missing_returns_error(console):

Callers

nothing calls this directly

Calls 4

screen_contentsMethod · 0.80
makeMethod · 0.45
load_flowMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…