27 Commits

Author SHA1 Message Date
Stephen Finucane
76474ff0da Remove six
Change-Id: I431bf688ca51825622d726f01fed4bb1eea5c564
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-07-26 17:37:49 +01:00
Vladyslav Drok
1670793bfe Print exceptions raised from from_param methods
This makes debugging the problems easier.

Change-Id: I285d8176b8cfb0cdf1e9cecd8ae5a0a7f0f109e7
2016-12-23 14:09:16 +02:00
Chris Dent
78d6b89d18 Enable real testing of python 3.4
The gate 34 tests were not running any tests because there was no
tox target. This changes tox-tmpl.ini (and the resulting tox.ini) to
add support for python 34 and remove support for anything that is
not py34 or py27-based.

To make the python3 tox environments work, the remote zip of a suds
fork has been replaced with suds-jurko, a relatively modern fork of
the original suds that supports python2 and 3.

Some tests needed to be fixed to deal with two main problems:

* reponse bodies being bytes
* Exceptions not having a .message attribute (.args[0] is used
  instead)
* the test_flask tests were not being run for python3, they are now
* wsmeext/sphinxext.py intermittently fails due to the dictionary
  changing size in flight, getting the keys prior to iteration fixes
  it

Both 27 and 34 should be running 420 tests as of this commit.

Change-Id: I837c249714fd957790ea84aa2fd9ad994a39c5ea
2015-04-28 14:59:33 +01:00
Lucas Alvares Gomes
de877d2cc8 Pecan: Make it possible to use the Response to return a non-default return type
This patch is extending the Response object and the Pecan extension
to make it possible to return a non-default return type (just like it
already supports retuning a non default status code).

This is useful when the return code of a function is 204 (No Response) for
that case we automatically set the return_type to be None and guarantee
that the response body is empty and the content-lentgh is 0. Which if
not done can cause tools consuming the API to misbehave.

Change-Id: I629c3e2d5dc169154e5af044f1b8f804e4b87e23
2015-04-01 14:44:46 +01:00
Ryan Petrello
26a6acdadd Add support for manually specifying supported content types in @wsmeexpose.
Closes-bug: #1271317
Change-Id: Ia28a912f4444a6ff77b1feaf2ea6440b0c738e86
2014-09-24 21:04:52 -04:00
Jenkins
b011b2c83f Merge "Validate body when using Pecan" 2013-10-14 14:19:23 +00:00
Jenkins
5b283a613f Merge "Return a ClientSideError if unable to convert data" 2013-10-14 14:18:41 +00:00
Julien Danjou
b67405d486 Validate body when using Pecan
This makes sure that when the body is decoded we run the validation
process on it.

Fixes-Bug: #1220678

Change-Id: I765a6ce8c8097ef0e0a734804242e9fcee4ffbcf
2013-10-09 17:14:02 +02:00
Julien Danjou
8a0c4e66c9 Return a ClientSideError if unable to convert data
This makes thing works at least for Pecan.

Change-Id: I7b02813258d9b8c2eea13e4215a3d711ec2e56ed
2013-10-09 16:08:22 +02:00
Yuriy Zveryanskyy
9546c10250 Add custom error code to ClientSideError
Added custom error status code for ClientSideError
exception instead of hardcoded value 400.
Fixed case when user exception with client error code
formatted as server error.
Pecan extension fixed.

Change-Id: I2663db0aa88538b722eb2783d130585b0fc2335b
2013-10-09 16:59:40 +03:00
Julien Danjou
cce52e1431 pecantest: remove useless config.py
Change-Id: I3370715d12209528fe63d5bd9bb7b7e78c935351
2013-09-26 17:59:56 +02:00
Julien Danjou
abcdd7affa Include Pecan tests in default Python environment
- Makes sure we always run Pecan test and that there's no regression.
  There's no real need to split them out as they are not invasive.
  Also that reduces the number of environment a bit.
- This also fixes Pecan tests on python2.6
- This also fixes Pecan tests on python3.3
- This also enables Pecan tests on python3.2

Change-Id: I57070b0bd785fb3d445f432973f15825abccbdd5
2013-09-26 17:37:03 +02:00
119Vik
651ad18bdd Fix for returned status code and .gitignore
For this purposes I added addiitional processing of original
exceptions at wsme/wsmeext/pecan.py. For exception's validation
special validator was added to wsme/wsmeext/utils.py. Also
functionality was reworked to be compatible with python3.3

Fixes bug#1214073
Change-Id: Ib1cd0b274bda11f62298848ebcd55b3f6641757c
2013-08-28 18:03:30 +03:00
Christophe de Vienne
f9fe028eff Fix issue #11 in the pecan adapter 2013-08-02 14:04:43 +02:00
Christophe de Vienne
8b235ef79a Add a unittest to reproduce issue #11 2013-08-02 13:24:06 +02:00
Angus Salkeld
4c581aac48 Test changing the default status_code in pecan 2013-04-30 15:26:06 +10:00
Angus Salkeld
6e5cb63d7a Add a test to make sure we can use the Response from pecan 2013-04-30 15:15:32 +10:00
Christophe de Vienne
cffcee226c Pecan adapter: Debug mode (which returns the exception tracebacks to the
client) can be enabled by the pecan application configuration.
2013-04-16 15:42:23 +02:00
Christophe de Vienne
d71b762ae3 Add a test to reproduce the bug reported by Endre Karlson 2013-02-15 14:33:25 +01:00
Christophe de Vienne
9ee2d2f9a2 Add a test for the body= parameter of wsexpose
--HG--
extra : rebase_source : fc9479a0aa0de8485440a70e86971666fea56fb8
2013-02-15 14:05:49 +01:00
Christophe de Vienne
8736089dc9 Moved non-core features to the wsmeext namespace package
--HG--
rename : wsme/cornice.py => wsmeext/cornice.py
rename : wsme/pecan.py => wsmeext/pecan.py
rename : wsme/sphinxext.py => wsmeext/sphinxext.py
rename : wsme/tg1.py => wsmeext/tg1.py
rename : wsme/tg11.py => wsmeext/tg11.py
rename : wsme/tg15.py => wsmeext/tg15.py
2013-01-17 13:15:25 +01:00
Christophe de Vienne
bd184770a3 Pecan adapter is now at 100% of code coverage 2013-01-17 12:01:55 +01:00
Christophe de Vienne
9aa7055f55 Fix array as input GET parameters in the pecan adapter 2012-12-18 10:09:09 +01:00
Doug Hellmann
2277370fca Fix error handling tests for pecan
The debug middleware always returns a 200 status, so
disable it.

The actual response status is the full string, not just
the number, so look for that.
2012-12-07 12:01:20 -05:00
Christophe de Vienne
38f5dd2bfd Add a test for client-side errors 2012-12-06 16:52:21 +01:00
Christophe de Vienne
67bf6c3dc4 resolve types in pecan.wsexpose. It is a temporary solution.
--HG--
extra : rebase_source : a6835042f14fb016722323496ba8b826a2a8aa9d
2012-11-29 22:24:39 +01:00
Christophe de Vienne
eaa6cc8083 Add a test for the pecan adapter 2012-11-06 22:37:33 +01:00