Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded specs_route from conftest #116

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

roo-oliv
Copy link
Contributor

@roo-oliv roo-oliv commented Jun 21, 2017

conftest assumes that specs_route will always be "/apidocs/".

This PR makes conftest to check if there is a reference to the Swagger object and if so it will pull specs_route from Swagger's config instance variable.

@coveralls
Copy link

coveralls commented Jun 21, 2017

Coverage Status

Coverage remained the same at 82.465% when pulling 47f49c3 on allrod5:fix-conftest into 88eb5c5 on rochacbruno:master.

@roo-oliv
Copy link
Contributor Author

roo-oliv commented Jun 21, 2017

@rochacbruno The code just looks for a variable named swag, have swagger = Swagger(app) and conftest won't see it and will fallback to /apidocs/ route.

As far as I know in Python it is not possible to access an object instance if there aren't any references to it at all, so if someone just code Swagger(app) and don't assign it to anything we can't inspect that.

But it may be feasible to use builtin dir() function to find any variable with any name holding a Swagger instance in the module and then inspect it. What do you think? Shall I do this or leave as it is.

@coveralls
Copy link

coveralls commented Jun 21, 2017

Coverage Status

Coverage remained the same at 82.465% when pulling 35f1f70 on allrod5:fix-conftest into 88eb5c5 on rochacbruno:master.

@rochacbruno rochacbruno merged commit 83942f5 into flasgger:master Jun 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants