Ensure that metadata roundtrips properly.
(self)
| 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 | } |