示例#1
0
        def test_arg2swagger_puts_json_arguments_in_schema(self):
            arg = Arg(int, location='json', description='a count', format='int32')
            res = arg2parameter(arg, 'username')
            assert res['name'] == 'body'
            assert 'description' not in res
            schema_props = res['schema']['properties']

            # property is defined on schema
            assert schema_props['username']['type'] == 'integer'
            assert schema_props['username']['description'] == arg.metadata['description']
            assert schema_props['username']['format'] == 'int32'
示例#2
0
 def test_no_schema_if_form_body(self):
     arg = Arg(int, location='form')
     res = arg2parameter(arg)
     assert 'schema' not in res
示例#3
0
 def test_schema_if_json_body(self):
     arg = Arg(int, location='json')
     res = arg2parameter(arg)
     assert 'schema' in res