Commit Graph

29 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
Brian Price
b0b83c4879 Converting response to raise a ProblemException (#955)
* Converting response to raise a ProblemException

* Centralizing around ProblemException for errors in the app.

* Adding the ability to skip error handlers, allow for defining exception payload.

* Fixing flake8

* Fixed some bugs found through unit testing.

* Unit tests are now passing.

* Added problem back to __init__

* Updating based on the feedback from the PR.
2019-10-24 10:59:05 +02:00
Mariusz Kupidura
b05bf6e292 Add validation of cookie parameters. (#997)
Validate parameters stored in cookies in similar manner that we validate
parameters passed in headers.
2019-07-13 11:28:50 +02: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
2f074998e3 URI parsing decorator (#613)
- array logic refactored into one place.
- validation.py and parameter.py no longer try to join the array, and the split it again.
- validation of defaults now works, because the validator is given the correct type.
- some additional classes that change the behavior of deduplicating query parameters that are defined multiple times
  - **AlwaysMultiURIParser** that is backwards compatible, warts and all (used by default)
  - **Swagger2URIParser** that adheres to the spec's definition of `collectionFormat: multi` and uses the last-defined query parameter value (ex. `query?a=1&a=2` => `a = 2`)
  - **FirstValueURIParser** that behaves like Swagger2URIParser, except that the first-defined value is used (ex. `query?a=1&a=2` => `a=1`)
2018-07-09 11:06:24 +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
5857dd237f Uncouple all flask functions from base code.
removed test_decorators and test_parameter (this test is useless now);
removed the request/response containers and add new request response classes;
created a abstract api class and a api flask class;
derived classes will implements the get_response/get_request methods that will convert framework req/resp types to connexion req/resp types;
moved the jsonifier from produces to flask api;
created a abstract app class and a app flask class;
changed all validators to use the ConnexionRequest instead flask request;
changed the problem function to generate a ConnexionRequest;
created a new user variables container called context (this is a property of ConnexionRequest). this will be passed as kwargs to all operations functions;
this context is used on authentication;
fixed all tests to new API;
some changes that I did may not be documented in this commit.
2017-04-04 08:20:24 -03:00
Patrick Williams
576275e928 fix content-type header bug 2017-01-09 22:03:11 -05:00
Rafael Caricio
3b5bb13276 Refactor code to fix confusion with returned values 2016-12-10 19:54:27 +01:00
Yoan Blanc
be437a980b Fix isort checks 2016-10-16 11:32:11 +02:00
Mathieu Louafi
704ad95536 fix array conversion during validation 2016-05-17 01:42:28 +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
Greg Brockman
a6cc07cca8 Make JSON printing a bit nicer 2016-04-04 21:59:54 -07:00
Rafael Caricio
2fec6e9259 Leave body param validation to external lib 2016-02-25 14:49:19 +01:00
hjacobs
6e3f08a8e6 add unit test for uWSGI metrics decorator 2016-01-12 21:18:13 +01:00
João Santos
559af21f90 #108 Cleanup 2015-12-10 15:55:35 +01:00
João Santos
ead3c31663 #108 Use json schema for parameters 2015-12-10 15:51:37 +01:00
Evan Lezar
8a6670b53e Add some basic unit tests to improve test coverage. 2015-10-28 18:00:03 +01:00
Henning Jacobs
2faaa903ef convert value to type before running validators 2015-09-04 11:35:10 +02:00
Henning Jacobs
954b77324d add test to check type conversion (minimum check on array of integers should work!) 2015-09-04 11:29:08 +02:00
Judd Vinet
4cb8b83331 Added tests for query/path array validation 2015-09-03 18:01:31 -07:00
Henning Jacobs
e1f78e4929 #48 fix Python 2.7 support by using "mock" backport module 2015-08-27 11:24:06 +02:00
Henning Jacobs
15f0d4ea94 #48 validate header parameters 2015-08-27 11:16:05 +02:00
Henning Jacobs
2404b9e69d #48 validate path parameters 2015-08-27 10:59:09 +02:00
Henning Jacobs
5e6a470989 validate min/max 2015-07-24 18:33:05 +02:00
Henning Jacobs
e8d6c011e8 add regex pattern validation 2015-07-24 18:21:11 +02:00