diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-09-25 21:09:13 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-01-05 11:30:20 +0100 |
commit | 2ca9dcd5b934bb85088415e44b967e2b93c00227 (patch) | |
tree | 3094084c954f31adc1ce11a12a96210919cda77f /qa/rpc-tests/test_framework | |
parent | fba1a6150c1f7f9e3b407faefba4ccc710fe075e (diff) |
test: Add test for RPC named arguments
Add RPC testcase for RPC named arguments.
Diffstat (limited to 'qa/rpc-tests/test_framework')
-rw-r--r-- | qa/rpc-tests/test_framework/util.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 85898d9f32..c29033595d 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -546,6 +546,18 @@ def assert_raises_message(exc, message, fun, *args, **kwds): else: raise AssertionError("No exception raised") +def assert_raises_jsonrpc(code, fun, *args, **kwds): + '''Check for specific JSONRPC exception code''' + try: + fun(*args, **kwds) + except JSONRPCException as e: + if e.error["code"] != code: + raise AssertionError("Unexpected JSONRPC error code %i" % e.error["code"]) + except Exception as e: + raise AssertionError("Unexpected exception raised: "+type(e).__name__) + else: + raise AssertionError("No exception raised") + def assert_is_hex_string(string): try: int(string, 16) |