Example #1
0
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"}
Example #2
0
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"}
Example #3
0
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, {})
Example #4
0
 def converter_type(self):
     return converter.Map(converter.CONVERT_TO_REQUEST_BODY)
Example #5
0
 def converter_type(self):
     return converter.Map(converter.CONVERT_TO_STRING)
Example #6
0
 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)