MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_http

Method test_http

examples/contrib/test_jsondump.py:56–72  ·  view source on GitHub ↗
(self, tmpdir)

Source from the content-addressed store, hash-verified

54 )
55
56 def test_http(self, tmpdir):
57 with requests_mock.Mocker() as mock:
58 mock.post("http://my-server", text=self.echo_response)
59 with taddons.context() as tctx:
60 a = tctx.script(example_dir.path("complex/jsondump.py"))
61 tctx.configure(
62 a,
63 dump_destination="http://my-server",
64 dump_username="user",
65 dump_password="pass",
66 )
67
68 tctx.invoke(a, "response", self.flow())
69 tctx.invoke(a, "done")
70
71 assert self.request["json"]["response"]["content"] == "message"
72 assert self.request["headers"]["Authorization"] == "Basic dXNlcjpwYXNz"

Callers

nothing calls this directly

Calls 6

flowMethod · 0.95
contextMethod · 0.80
scriptMethod · 0.80
postMethod · 0.45
pathMethod · 0.45
configureMethod · 0.45

Tested by

no test coverage detected