Trax-air / swagger-tester

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

Not working on Ubuntu #9

Closed Sinuhe20 closed 8 years ago

Sinuhe20 commented 8 years ago

Hello,

swagger-tester seems not to work on Ubuntu 14.04. When I cloned the repository and tried to install the library with 'make install', everything was ok. But when compiling the example with calling a url the result is:

No handlers could be found for logger "swagger_tester.swagger_tester"
Traceback (most recent call last):
  File "swagtest.py", line 9, in <module>
    swagger_test(app_url='http://petstore.swagger.io/v2', authorize_error=authorize_error)
  File "/usr/local/lib/python2.7/dist-packages/swagger_tester-0.2.2-py2.7.egg/swagger_tester/swagger_tester.py", line 196, in swagger_test
    use_example=use_example):
  File "/usr/local/lib/python2.7/dist-packages/swagger_tester-0.2.2-py2.7.egg/swagger_tester/swagger_tester.py", line 266, in swagger_test_yield
    data=body)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 421, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 359, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 290, in prepare
    self.prepare_body(data, files)
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 430, in prepare_body
    body = self._encode_params(data)
  File "/usr/lib/python2.7/dist-packages/requests/models.py", line 86, in _encode_params
    return urlencode(result, doseq=True)
  File "/usr/lib/python2.7/urllib.py", line 1349, in urlencode
    len(v)
AttributeError: StringIO instance has no attribute '__len__'

Code for example program is:

from swagger_tester import swagger_test

authorize_error = {
  'get': {
    '/pet/': ['400', '404']
  }
}

swagger_test(app_url='http://petstore.swagger.io/v2', authorize_error=authorize_error)
flavianh commented 8 years ago

We're working on a fix, there seems to be an issue about file uploads, so thanks for providing all the useful data :+1: May I ask why you installed directly from the source and not from pip? I'd also be interested in your use cases and how you found out about the lib? Feel free to have a chat on our gitter (link on the README)

cyprieng commented 8 years ago

@OliverSanftleben should be fixed. Thanks for the report !