File tree 1 file changed +29
-0
lines changed
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):
311
311
other_schemas ,
312
312
)
313
313
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
+
314
343
def test_add_body_bad_multipart_data (self , mocker ):
315
344
from openapi_python_client .parser .openapi import Endpoint , Schemas
316
345
You can’t perform that action at this time.
0 commit comments