File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,35 @@ def test_add_body_bad_json_data(self, mocker):
311311 other_schemas ,
312312 )
313313
314+ def test_add_body_bad_form_data (self , enum_property_factory ):
315+ from openapi_python_client .parser .openapi import Endpoint , Schemas
316+
317+ schemas = Schemas (
318+ errors = [ParseError (detail = "existing error" )],
319+ )
320+ endpoint = self .make_endpoint ()
321+ bad_schema = oai .Schema .construct (type = oai .DataType .ARRAY )
322+
323+ result = Endpoint ._add_body (
324+ endpoint = endpoint ,
325+ data = oai .Operation .construct (
326+ requestBody = oai .RequestBody .construct (
327+ content = {"application/x-www-form-urlencoded" : oai .MediaType .construct (media_type_schema = bad_schema )}
328+ )
329+ ),
330+ schemas = schemas ,
331+ config = Config (),
332+ )
333+
334+ assert result == (
335+ ParseError (
336+ detail = "type array must have items defined" ,
337+ header = "Cannot parse form body of endpoint name" ,
338+ data = bad_schema ,
339+ ),
340+ schemas ,
341+ )
342+
314343 def test_add_body_bad_multipart_data (self , mocker ):
315344 from openapi_python_client .parser .openapi import Endpoint , Schemas
316345
You can’t perform that action at this time.
0 commit comments