mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 19:11:02 +00:00
remove flaky rpc subscription tests (#11653)
This commit is contained in:
@@ -241,34 +241,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn subscribe_and_unsubscribe_to_justifications() {
|
||||
let (rpc, _) = setup_io_handler();
|
||||
|
||||
// Subscribe call.
|
||||
let sub = rpc
|
||||
.subscribe("beefy_subscribeJustifications", EmptyParams::new())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let ser_id = serde_json::to_string(sub.subscription_id()).unwrap();
|
||||
|
||||
// Unsubscribe
|
||||
let unsub_req = format!(
|
||||
"{{\"jsonrpc\":\"2.0\",\"method\":\"beefy_unsubscribeJustifications\",\"params\":[{}],\"id\":1}}",
|
||||
ser_id
|
||||
);
|
||||
let (response, _) = rpc.raw_json_request(&unsub_req).await.unwrap();
|
||||
|
||||
assert_eq!(response, r#"{"jsonrpc":"2.0","result":true,"id":1}"#);
|
||||
|
||||
// Unsubscribe again and fail
|
||||
let (response, _) = rpc.raw_json_request(&unsub_req).await.unwrap();
|
||||
let expected = r#"{"jsonrpc":"2.0","result":false,"id":1}"#;
|
||||
|
||||
assert_eq!(response, expected);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn subscribe_and_unsubscribe_with_wrong_id() {
|
||||
let (rpc, _) = setup_io_handler();
|
||||
|
||||
@@ -310,33 +310,6 @@ mod tests {
|
||||
assert_eq!(expected_response, result);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn subscribe_and_unsubscribe_to_justifications() {
|
||||
let (rpc, _) = setup_io_handler(TestVoterState);
|
||||
// Subscribe call.
|
||||
let sub = rpc
|
||||
.subscribe("grandpa_subscribeJustifications", EmptyParams::new())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let ser_id = serde_json::to_string(sub.subscription_id()).unwrap();
|
||||
|
||||
// Unsubscribe
|
||||
let unsub_req = format!(
|
||||
"{{\"jsonrpc\":\"2.0\",\"method\":\"grandpa_unsubscribeJustifications\",\"params\":[{}],\"id\":1}}",
|
||||
ser_id
|
||||
);
|
||||
let (response, _) = rpc.raw_json_request(&unsub_req).await.unwrap();
|
||||
|
||||
assert_eq!(response, r#"{"jsonrpc":"2.0","result":true,"id":1}"#);
|
||||
|
||||
// Unsubscribe again and fail
|
||||
let (response, _) = rpc.raw_json_request(&unsub_req).await.unwrap();
|
||||
let expected = r#"{"jsonrpc":"2.0","result":false,"id":1}"#;
|
||||
|
||||
assert_eq!(response, expected);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn subscribe_and_unsubscribe_with_wrong_id() {
|
||||
let (rpc, _) = setup_io_handler(TestVoterState);
|
||||
|
||||
Reference in New Issue
Block a user