More error checking (WIP)

This commit is contained in:
coffeepots 2018-06-21 18:40:49 +01:00
parent b632cbfb25
commit 09b55a5b32

View File

@ -45,24 +45,36 @@ suite "RPC Errors":
# Note: We don't expect a exceptions for most of the tests,
# because the server should respond with the error in json
test "Missing RPC":
expect ValueError:
#expect ValueError:
try:
let res = waitFor testMissingRpc()
check res.error == true and
res.result["message"] == %"Method not found" and
res.result["data"] == %"phantomRpc is not a registered method."
except:
echo "Error ", getCurrentExceptionMsg()
test "Incorrect json version":
expect ValueError:
#expect ValueError:
try:
let res = waitFor testInvalidJsonVer()
check res.error == true and res.result["message"] == %"JSON 2.0 required"
except:
echo "Error ", getCurrentExceptionMsg()
test "Raising exceptions":
expect ValueError:
#expect ValueError:
try:
let res = waitFor testRaise()
except:
echo "Error ", getCurrentExceptionMsg()
test "Malformed json":
# TODO: We time out here because the server won't be able to
# find an id to return to us, so we cannot complete the future.
let res = waitFor testMalformed()
check res.error == true and res.result == %"Timeout"
try:
let res = waitFor testMalformed()
check res.error == true and res.result == %"Timeout"
except:
echo "Error ", getCurrentExceptionMsg()