def test_header_decoder(): headers = { "testprefix.foo": "FOO", "testprefix.bar": "BAR", "testprefix.baz": "BAZ", "bogusprefix.foo": "XXX", "testprefix.call_id_stack": ["a", "b", "c"], } decoder = HeaderDecoder() with patch.object(decoder, "header_prefix", new="testprefix"): worker_ctx_cls = worker_context_factory("foo", "bar", "call_id_stack") message = Mock(headers=headers) res = decoder.unpack_message_headers(worker_ctx_cls, message) assert res == {"foo": "FOO", "bar": "BAR", "call_id_stack": ["a", "b", "c"]}
def test_header_decoder(): headers = { 'testprefix.foo': 'FOO', 'testprefix.bar': 'BAR', 'testprefix.baz': 'BAZ', 'bogusprefix.foo': 'XXX', 'testprefix.call_id_stack': ['a', 'b', 'c'], } decoder = HeaderDecoder() with patch.object(decoder, 'header_prefix', new="testprefix"): worker_ctx_cls = worker_context_factory("foo", "bar", "call_id_stack") message = Mock(headers=headers) res = decoder.unpack_message_headers(worker_ctx_cls, message) assert res == { 'foo': 'FOO', 'bar': 'BAR', 'call_id_stack': ['a', 'b', 'c'], }
def test_header_decoder(): headers = { 'testprefix.foo': 'FOO', 'testprefix.bar': 'BAR', 'testprefix.baz': 'BAZ', 'differentprefix.foo': 'XXX', 'testprefix.call_id_stack': ['a', 'b', 'c'], } decoder = HeaderDecoder() with patch.object(decoder, 'header_prefix', new="testprefix"): message = Mock(headers=headers) res = decoder.unpack_message_headers(message) assert res == { 'foo': 'FOO', 'bar': 'BAR', 'baz': 'BAZ', 'call_id_stack': ['a', 'b', 'c'], 'differentprefix.foo': 'XXX' }