Commit graph

9 commits

Author SHA1 Message Date
Wladimir J. van der Laan 42f6aed731 tests: Add exception error message for JSONRPCException
This improves error reporting if `JSONRPCException` is not specifically caught
and ends up in Python's default backtrace handler.

Before:
```
Traceback (most recent call last):
  File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 153, in __call__
    raise JSONRPCException(response['error'])
test_framework.authproxy.JSONRPCException
```

After:
```
Traceback (most recent call last):
  File "/.../projects/bitcoin/bitcoin/qa/rpc-tests/test_framework/authproxy.py", line 152, in __call__
    raise JSONRPCException(response['error'])
test_framework.authproxy.JSONRPCException: Unknown named parameter random (-8)
```
2016-09-25 20:05:03 +02:00
Wladimir J. van der Laan a406fcb6ca test: add ensure_ascii setting to AuthServiceProxy
Add a setting ensure_ascii to AuthServiceProxy. This setting,
defaulting to True (backwards compatible),
is passed through to json.dumps. If set to False, non-ASCII characters
>0x80 are not escaped. This is useful for testing server
input processing, as well as slightly more bandwidth friendly in case of
heavy unicode usage.
2016-06-10 15:20:49 +02:00
Pieter Wuille f45f51e3ae Fix interrupted HTTP RPC connection workaround for Python 3.5+ 2016-06-02 19:17:04 +02:00
Wladimir J. van der Laan 5078ca4543 tests: Check Content-Type header returned from RPC server
Check the Content-Type header that is returned from the RPC server. Only
if it is `application/json` the data is supposed to be parsed as JSON.

This gives better reporting if the HTTP server happens to return an error that is
not JSON-formatted, which is the case if it happens at a lower level
before JSON-RPC kicks in.

Before: `Unexpected exception caught during testing: No JSON object could be decoded`

After: `JSONRPC error: non-JSON HTTP response with '403 Forbidden' from server`
2016-04-07 15:40:17 +02:00
Luke Dashjr e7e48ba66c test_framework: Py3.4 compat: Specify timeout parameter by name
Changed in version 3.4: The strict parameter was removed. HTTP 0.9-style
“Simple Responses” are not longer supported.
(https://docs.python.org/3/library/http.client.html)

Source: 7ebeebb4f6
2016-03-28 12:30:48 +02:00
Wladimir J. van der Laan d7b80b54fb test_framework: Avoid infinite loop in encoding Decimal
Avoid an infinite loop in encoding, by ensuring EncodeDecimal
returns a string. round(Decimal) used to convert it to
float, but it no longer does in python 3.x. Strings are
supported since #6380, so just use that.
2016-03-28 12:20:13 +02:00
James O'Beirne b5cbd396ca Add basic coverage reporting for RPC tests
Thanks to @MarcoFalke @dexX7 @laanwj for review.
2015-11-11 10:33:43 -08:00
Wladimir J. van der Laan ddf98d1d84 Make RPC tests cope with server-side timeout between requests
Python's httplib does not graciously handle disconnections from the http server, resulting in BadStatusLine errors.
See https://bugs.python.org/issue3566 "httplib persistent connections violate MUST in RFC2616 sec 8.1.4."

This was fixed in Python 3.5.

Work around it for now.
2015-09-21 17:15:37 +02:00
Jonas Schnelli 7b7f258396 rpc-tests: remove python-bitcoinrpc directory
place authproxy.py at same level as other utility classes
2015-05-21 21:22:22 +02:00
Renamed from qa/rpc-tests/test_framework/python-bitcoinrpc/bitcoinrpc/authproxy.py (Browse further)