class TestPartMap(ArgumentTestCase): type_cls = types.PartMap expected_converter_type = converter.Map(converter.CONVERT_TO_REQUEST_BODY) def test_modify_request(self, request_builder): types.PartMap().modify_request(request_builder, {"hello": "world"}) assert request_builder.info["files"] == {"hello": "world"}
class TestHeaderMap(ArgumentTestCase): type_cls = types.HeaderMap expected_converter_type = converter.Map(converter.CONVERT_TO_STRING) def test_modify_request(self, request_builder): types.HeaderMap().modify_request(request_builder, {"hello": "world"}) assert request_builder.info["headers"] == {"hello": "world"}
class TestFieldMap(ArgumentTestCase): type_cls = types.FieldMap expected_converter_type = converter.Map(converter.CONVERT_TO_STRING) def test_modify_request(self, request_builder): types.FieldMap().modify_request(request_builder, {"hello": "world"}) assert request_builder.info["data"] == {"hello": "world"} def test_modify_request_failure(self, request_builder): request_builder.info["data"] = object() with pytest.raises(types.FieldMap.FieldMapUpdateFailed): types.FieldMap().modify_request(request_builder, {})
def converter_type(self): return converter.Map(converter.CONVERT_TO_REQUEST_BODY)
def converter_type(self): return converter.Map(converter.CONVERT_TO_STRING)
def test_with_converter_map(self, converter_factory_mock): registry = converter.ConverterFactoryRegistry( (converter_factory_mock, )) converter_ = registry[converter.Map(converter.CONVERT_TO_STRING)]() assert isinstance(converter_, converter.MappingConverterDecorator)