def __init__(self, param_or_header, deserializer_callable):
        self.param_or_header = param_or_header
        self.deserializer_callable = deserializer_callable

        self.aslist = get_aslist(self.param_or_header)
        self.explode = get_explode(self.param_or_header)
        self.style = get_style(self.param_or_header)
Exemple #2
0
    def __init__(self, param, deserializer_callable):
        self.param = param
        self.deserializer_callable = deserializer_callable

        self.aslist = get_aslist(self.param)
        self.explode = get_explode(self.param)
        self.style = get_style(self.param)
Exemple #3
0
    def test_defaults_true(self, location):
        spec = {
            'name': 'default',
            'in': location,
            'style': 'form',
        }
        param = SpecPath.from_spec(spec)
        result = get_explode(param)

        assert result is True
Exemple #4
0
    def test_defaults_false(self, style, location):
        spec = {
            'name': 'default',
            'in': location,
            'style': style,
        }
        param = SpecPath.from_spec(spec)
        result = get_explode(param)

        assert result is False
Exemple #5
0
    def test_defaults_true(self, location):
        spec = {
            "name": "default",
            "in": location,
            "style": "form",
        }
        param = SpecPath.from_spec(spec)
        result = get_explode(param)

        assert result is True
Exemple #6
0
    def test_defaults_false(self, style, location):
        spec = {
            "name": "default",
            "in": location,
            "style": style,
        }
        param = SpecPath.from_spec(spec)
        result = get_explode(param)

        assert result is False
Exemple #7
0
    def test_defined(self, location, style, schema_type, explode):
        spec = {
            'name': 'default',
            'in': location,
            'explode': explode,
            'schema': {
                'type': schema_type,
            }
        }
        param = SpecPath.from_spec(spec)
        result = get_explode(param)

        assert result == explode
Exemple #8
0
    def test_defined(self, location, style, schema_type, explode):
        spec = {
            "name": "default",
            "in": location,
            "explode": explode,
            "schema": {
                "type": schema_type,
            },
        }
        param = SpecPath.from_spec(spec)
        result = get_explode(param)

        assert result == explode
Exemple #9
0
    def _get_parameter_value(self, param, request):
        param_location = param['in']
        location = request.parameters[param_location]

        if param['name'] not in location:
            if param.getkey('required', False):
                raise MissingRequiredParameter(param['name'])

            raise MissingParameter(param['name'])

        aslist = get_aslist(param)
        explode = get_explode(param)
        if aslist and explode:
            if hasattr(location, 'getall'):
                return location.getall(param['name'])
            return location.getlist(param['name'])

        return location[param['name']]
Exemple #10
0
    def __init__(self, param_or_header, style, deserializer_callable):
        super().__init__(param_or_header, style)
        self.deserializer_callable = deserializer_callable

        self.aslist = get_aslist(self.param_or_header)
        self.explode = get_explode(self.param_or_header)