Unverified Commit 45cfdf08 authored by Alexandru Vasile's avatar Alexandru Vasile
Browse files

Use valid Json-RPC return code for test errors


Signed-off-by: default avatarAlexandru Vasile <alexandru.vasile@parity.io>
parent 639e5248
Pipeline #200611 passed with stages
in 5 minutes and 28 seconds
......@@ -368,10 +368,12 @@ async fn empty_subscription_without_server() {
#[tokio::test]
async fn rejected_subscription_without_server() {
// Specialized JSON-RPC server error for rejected purposes.
const ERROR: i32 = -32090;
let mut module = RpcModule::new(());
module
.register_subscription("my_sub", "my_sub", "my_unsub", |_, mut sink, _| {
let err = ErrorObject::borrowed(0, &"rejected", None);
let err = ErrorObject::borrowed(ERROR, &"rejected", None);
sink.reject(err.into_owned())?;
Ok(())
})
......@@ -379,5 +381,7 @@ async fn rejected_subscription_without_server() {
let sub_err = module.subscribe("my_sub", EmptyParams::new()).await.unwrap_err();
assert!(matches!(sub_err, Error::Call(CallError::Custom(e)) if e.message().contains("rejected") && e.code() == 0));
assert!(
matches!(sub_err, Error::Call(CallError::Custom(e)) if e.message().contains("rejected") && e.code() == ERROR)
);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment