MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_metadata

Method test_metadata

test/mitmproxy/contentviews/test__api.py:70–90  ·  view source on GitHub ↗

Ensure that metadata roundtrips properly.

(self)

Source from the content-addressed store, hash-verified

68 assert not msgpack < msgpack
69
70 def test_metadata(self):
71 """Ensure that metadata roundtrips properly."""
72 f = tflow.tflow()
73 f.request.headers["HoSt"] = "example.com"
74 meta = Metadata(
75 content_type="text/html",
76 flow=f,
77 http_message=f.request,
78 protobuf_definitions=Path("example.proto"),
79 )
80
81 out = _test_inspect_metadata.prettify(b"", meta)
82 actual = YAML(typ="safe", pure=True).load(out)
83
84 assert actual == {
85 "content_type": "text/html",
86 "headers": {"host": "example.com"},
87 "is_http_request": True,
88 "path": "/path",
89 "protobuf_definitions": "example.proto",
90 }

Callers

nothing calls this directly

Calls 4

MetadataClass · 0.90
PathClass · 0.85
prettifyMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected