Trax-air / swagger-tester

Automatically test your swagger API
MIT License
105 stars 36 forks source link

python setup.py test gives error #32

Closed ghost closed 8 years ago

ghost commented 8 years ago

I follow the instructions here

when running: python setup.py test

I get:

tests/test_swagger-tester.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swagger_tester/swagger_tester.py:212: in swagger_test
    use_example=use_example):
swagger_tester/swagger_tester.py:301: in swagger_test_yield
    response_spec = swagger_parser.get_request_data(path, action, body_req)
../../.virtualenvs/swagger_tester/lib/python2.7/site-packages/swagger_parser-0.1.10-py2.7.egg/swagger_parser/swagger_parser.py:641: in get_request_data
    response[int(status_code)] = self.get_response_example(resp)
../../.virtualenvs/swagger_tester/lib/python2.7/site-packages/swagger_parser-0.1.10-py2.7.egg/swagger_parser/swagger_parser.py:616: in get_response_example
    return self.get_example_from_prop_spec(resp_spec['schema'])
../../.virtualenvs/swagger_tester/lib/python2.7/site-packages/swagger_parser-0.1.10-py2.7.egg/swagger_parser/swagger_parser.py:167: in get_example_from_prop_spec
    return [self._get_example_from_properties(prop_spec)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <swagger_parser.swagger_parser.SwaggerParser object at 0x10a1ba090>
spec = {'additionalProperties': {'format': 'int32', 'type': 'integer'}, 'type': 'object'}

    def _get_example_from_properties(self, spec):
        """Get example from the properties of an object defined inline.

            Args:
                prop_spec: property specification you want an example of.

            Returns:
                An example.
            """
        example = {}
>       required = spec.get('required', spec['properties'].keys())
E       KeyError: 'properties'

../../.virtualenvs/swagger_tester/lib/python2.7/site-packages/swagger_parser-0.1.10-py2.7.egg/swagger_parser/swagger_parser.py:190: KeyError
cyprieng commented 8 years ago

Thanks I will check that

cyprieng commented 8 years ago

Will be fix by #27

cyprieng commented 8 years ago

It should works now