def test_transformer_provides_default_transformer_fn(serve, mod, json_format): grpc_proxy_client = Mock() def _request(data): return data * 2 grpc_proxy_client.request.side_effect = _request transformer = serve.Transformer(grpc_proxy_client=grpc_proxy_client) result = transformer.transform("[1,2,3]", "application/json", "application/json") assert result == ('[1, 2, 3, 1, 2, 3]', 'application/json')
def test_transformer_default_input_fn_unsupported_type(): content_type = 'fake/content-type' with pytest.raises(UnsupportedContentTypeError): serve.Transformer(None)._default_input_fn(None, content_type)