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)
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)
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
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
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
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
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
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
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']]
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)