mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
test: Add test for RPC named arguments
Add RPC testcase for RPC named arguments.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user