@@ -370,14 +370,59 @@ def test_post_pets(self, spec, spec_dict):
370370 pet_tag = 'cats'
371371 pet_street = 'Piekna'
372372 pet_city = 'Warsaw'
373+ pet_healthy = False
373374 data_json = {
374375 'name' : pet_name ,
375376 'tag' : pet_tag ,
376377 'position' : '2' ,
377378 'address' : {
378379 'street' : pet_street ,
379380 'city' : pet_city ,
380- }
381+ },
382+ 'healthy' : pet_healthy ,
383+ }
384+ data = json .dumps (data_json )
385+
386+ request = MockRequest (
387+ host_url , 'POST' , '/pets' ,
388+ path_pattern = path_pattern , data = data ,
389+ )
390+
391+ parameters = request .get_parameters (spec )
392+
393+ assert parameters == {}
394+
395+ body = request .get_body (spec )
396+
397+ schemas = spec_dict ['components' ]['schemas' ]
398+ pet_model = schemas ['PetCreate' ]['x-model' ]
399+ address_model = schemas ['Address' ]['x-model' ]
400+ assert body .__class__ .__name__ == pet_model
401+ assert body .name == pet_name
402+ assert body .tag == pet_tag
403+ assert body .position == 2
404+ assert body .address .__class__ .__name__ == address_model
405+ assert body .address .street == pet_street
406+ assert body .address .city == pet_city
407+ assert body .healthy == pet_healthy
408+
409+ def test_post_pets_boolean_string (self , spec , spec_dict ):
410+ host_url = 'http://petstore.swagger.io/v1'
411+ path_pattern = '/v1/pets'
412+ pet_name = 'Cat'
413+ pet_tag = 'cats'
414+ pet_street = 'Piekna'
415+ pet_city = 'Warsaw'
416+ pet_healthy = 'false'
417+ data_json = {
418+ 'name' : pet_name ,
419+ 'tag' : pet_tag ,
420+ 'position' : '2' ,
421+ 'address' : {
422+ 'street' : pet_street ,
423+ 'city' : pet_city ,
424+ },
425+ 'healthy' : pet_healthy ,
381426 }
382427 data = json .dumps (data_json )
383428
@@ -402,6 +447,7 @@ def test_post_pets(self, spec, spec_dict):
402447 assert body .address .__class__ .__name__ == address_model
403448 assert body .address .street == pet_street
404449 assert body .address .city == pet_city
450+ assert body .healthy is False
405451
406452 def test_post_pets_empty_body (self , spec , spec_dict ):
407453 host_url = 'http://petstore.swagger.io/v1'
0 commit comments