Commit Graph

51 Commits

Author SHA1 Message Date
jlaba
16a896cdbf Switched from mock to unittest.mock (#1218)
* Switched from mock to unittest.mock

* Update test_validation.py

Removed mock comment

* Update test_parameter.py

Removed comment for mock

Co-authored-by: Joachim Langenbach <joachim.langenbach@engsas.de>
2020-04-23 22:59:41 +02:00
drewdogg
16ef766b89 Fix unit tests on Windows (#1071) 2019-12-03 00:05:45 +01:00
Daniel Grossmann-Kavanagh
08e4536e5e bump and pin isort, apply all automatic fixes (#903)
Fixes the build.

Changes proposed in this pull request:
 - apply all of the isort changes that resulted from the latest version
 - pin to the latest version (4.3.15) so this doesn't happen again, unless we bump the version on purpose
2019-03-15 13:04:33 +01:00
Daniel Grossmann-Kavanagh
72b16676cf simplify Operation class construction (#726)
* simplify *Operation creation

* move Specification classes to separate file
2018-11-15 07:45:59 +01:00
João Santos
44ea9336fe Connexion 2.0 (#619)
- App and Api options must be provided through the "options" argument (``old_style_options`` have been removed).
- You must specify a form content-type in 'consumes' in order to consume form data.
- The `Operation` interface has been formalized in the `AbstractOperation` class.
- The `Operation` class has been renamed to `Swagger2Operation`.
- Array parameter deserialization now follows the Swagger 2.0 spec more closely.
  In situations when a query parameter is passed multiple times, and the collectionFormat is either csv or pipes, the right-most value will be used.
  For example, `?q=1,2,3&q=4,5,6` will result in `q = [4, 5, 6]`.
  The old behavior is available by setting the collectionFormat to `multi`, or by importing `decorators.uri_parsing.AlwaysMultiURIParser` and passing `parser_class=AlwaysMultiURIParser` to your Api.
- The spec validator library has changed from `swagger-spec-validator` to `openapi-spec-validator`.
- Errors that previously raised `SwaggerValidationError` now raise the `InvalidSpecification` exception.
  All spec validation errors should be wrapped with `InvalidSpecification`.
- Support for nullable/x-nullable, readOnly and writeOnly/x-writeOnly has been added to the standard json schema validator.
- Custom validators can now be specified on api level (instead of app level).
- Added support for basic authentication and apikey authentication
- If unsupported security requirements are defined or ``x-tokenInfoFunc``/``x-tokenInfoUrl`` is missing, connexion now denies requests instead of allowing access without security-check.
- Accessing ``connexion.request.user`` / ``flask.request.user`` is no longer supported, use ``connexion.context['user']`` instead
2018-11-05 14:50:42 +01:00
Daniel Grossmann-Kavanagh
0b19ed489a Update to swagger-spec-validator 2.3.1 (fixes #612) (#611) 2018-07-03 08:21:43 +02:00
Mike Ralphson
d7cea4e1b3 Tests; remove duplicate test of missing_op_id in debug mode 2017-08-31 10:26:22 +01:00
Rafael Caricio
6746cb2be8 Fix mocking API partially 2017-06-30 16:46:26 +02:00
Rafael Carício
93c06711ed New style of passing options to Connexion (#436)
* Order classes by relevance in module

* Order definitions by relevance within module

* Swagger UI options extracted

* New style options

* Use new-style options

* Reuse code

* Sort imports

* Ignore typing imports

* Warn users about parameter name change

* Add back isort check

* Fix isort check
2017-04-11 16:47:21 +02:00
Rafael Carício
1858c9d4a0 Flask required only if necessary (#424)
* Example with Flask support

* Only show import error when trying to use Flask

* Re-organize imports

* Move flask_utils next to related module

* Code style

* Change back to incentivizes

* Includes Flask by default

* Project clean up

* Update Rafael Caricio's e-mail address

* Fix conflicts
2017-04-04 20:48:08 +02:00
Diogo Dutra
3952ea2771 did changes requested by isort and flake8 2017-04-04 08:20:25 -03:00
Diogo Dutra
a7af62fbf0 Uncouple flask from App and Api. Created Abstract classes for theses modules. Fixed the tests 2017-04-04 08:20:23 -03:00
Yoan Blanc
be437a980b Fix isort checks 2016-10-16 11:32:11 +02:00
Henning Jacobs
f289b40b99 #290 fix basePath with trailing slash 2016-10-04 10:57:49 +02:00
Jens Finkhaeuser
fa328f7709 Move bad_specs fixtures to its own fixtures folder 2016-09-13 16:53:00 +02:00
Jens Finkhaeuser
74cec244b4 Fixes after running & fixing TOXENV=isort-check tox 2016-09-13 16:24:28 +02:00
Jens Finkhaeuser
6476c033d2 Fix isort errors 2016-09-13 16:03:57 +02:00
Jens Finkhaeuser
ecd7d3ab6c Fix tests after merge 2016-09-13 15:52:02 +02:00
Jens Finkhaeuser
9d4a40ee38 Merge branch 'fix-missing-operation-id' into bad-operation-id-to-5xx
See #274 for discussion.
2016-09-13 15:37:23 +02:00
Jens Finkhaeuser
62f29c6256 Fix tests: in non-debug mode, original errors will be raised, which is
an ImportError in this case.
2016-09-13 15:27:23 +02:00
Rafael Caricio
0bebd0e643 Split swagger spec for consistent testing 2016-09-13 15:03:40 +02:00
Rafael Caricio
ccce2f85fe Pass along exceptions related to user mistakes 2016-09-13 12:00:41 +02:00
Rafael Caricio
3f33a54ec3 Fix tests path from fixtures 2016-09-13 11:46:59 +02:00
Jens Finkhaeuser
328aa51f6c Fix isort errors. Some of these look like they're not from my branch to
begin with.
2016-09-12 13:56:29 +02:00
Jens Finkhaeuser
37154d3b9a Makes sure #250 is still working. This explicitly handles ImportError
and re-raises its exception information if exceptions relating to
name resolution are raised at all.
It still converts the meaningless ValueError and AttributeError into a
ResolverError.
2016-09-09 11:53:16 +02:00
Jens Finkhaeuser
1e786d9538 If a ResolverError is raised during the addition of operations, and a
resolver_error_handler is provided, try to add that as an operation with
a randomized endpoint name. Otherwise, behave as before.
2016-09-09 11:52:05 +02:00
Jens Finkhaeuser
8c556543a9 Move ResolverError over to exceptions where it seems to be long. 2016-09-09 11:52:05 +02:00
Jens Finkhaeuser
92f51eab2a Improve Api test cases 2016-09-09 11:52:05 +02:00
Jens Finkhaeuser
875efbf258 Obviously, ImportError no longer falls through. That should have been
part of the PR earlier.
2016-09-09 11:52:05 +02:00
Jens Finkhaeuser
ad0a908691 Add test cases for missing and bad operationIds - slightly different from
the module with error case, but the result should be the same.
2016-09-09 11:52:05 +02:00
Jens Finkhaeuser
6697dc334f Makes sure #250 is still working. This explicitly handles ImportError
and re-raises its exception information if exceptions relating to
name resolution are raised at all.
It still converts the meaningless ValueError and AttributeError into a
ResolverError.
2016-09-07 15:16:59 +02:00
Jens Finkhaeuser
255e419572 Move ResolverError over to exceptions where it seems to be long. 2016-09-07 13:08:04 +02:00
Jens Finkhaeuser
c6cc024b1e Improve Api test cases 2016-09-07 12:41:59 +02:00
Jens Finkhaeuser
b321626c4c Obviously, ImportError no longer falls through. That should have been
part of the PR earlier.
2016-09-07 10:47:32 +02:00
Jens Finkhaeuser
ee86744046 Add test cases for missing and bad operationIds - slightly different from
the module with error case, but the result should be the same.
2016-09-07 10:07:46 +02:00
Rafael Caricio
0ac6721f4e Comprehensive error on invalid Swagger Spec 2016-06-28 10:47:39 +02:00
Rafael Caricio
cfcdfa72a4 Use safe_load to avoid code invocation from YAML files 2016-06-28 10:43:02 +02:00
Rafael Caricio
d7a8880378 Sort imports 2016-06-25 21:32:57 +02:00
Rafael Caricio
98e99ed9e3 Opens spec file as binary and then handle problems with encoding.
Should fix issue #249.
2016-06-25 20:32:43 +02:00
David Hotham
851d04372e isort imports 2016-06-10 20:39:51 +01:00
João Santos
87afbfe6eb #218 Raise import errors on endpoint handling 2016-06-08 15:11:06 +02:00
Rafael Caricio
415a1e8a60 Fix isort issues 2016-05-10 14:54:14 +02:00
Rafael Caricio
637d6efb27 Fix #220 Defer user error handing for swagger spec validator 2016-05-10 11:51:43 +02:00
Rafael Caricio
c30bdbb324 Fix import sorting in examples and tests 2016-04-08 14:33:27 +02:00
Rafael Caricio
a86b96c5e2 Sort imports in tests and examples 2016-04-08 14:33:27 +02:00
Rafael Caricio
6358c8c47d Adopt isort to ensure better code quality 2016-04-08 14:33:27 +02:00
Rafael Caricio
b60646e047 Reorganizing tests 2016-02-25 14:49:19 +01:00
Rafael Caricio
743feb133b Use debug flag to decide how to handle errors in API spec 2016-02-24 13:16:32 +01:00
Rafael Caricio
18492d6852 App breaks if error adding operation 2016-02-23 18:17:38 +01:00
John Kleijn
5fe88cba08 Addressed overlapping method names problem and removed main module as default 2015-12-06 10:32:06 +01:00