Skip to content

Commit

Permalink
add some node api participation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Jul 18, 2023
1 parent 5a1c939 commit 926980d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sdk/tests/client/node_api/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,16 @@ async fn test_get_address_outputs() {
let r = client.get_outputs(&output_ids_response.items).await.unwrap();
println!("{r:#?}");

let r = client.get_outputs_ignore_errors(&output_ids_response.items).await.unwrap();
let r = client
.get_outputs_ignore_errors(&output_ids_response.items)
.await
.unwrap();
println!("{r:#?}");

let r = client.get_outputs_metadata_ignore_errors(&output_ids_response.items).await.unwrap();
let r = client
.get_outputs_metadata_ignore_errors(&output_ids_response.items)
.await
.unwrap();
println!("{r:#?}");
}

Expand Down
1 change: 1 addition & 0 deletions sdk/tests/client/node_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod core;
mod indexer;
#[cfg(feature = "mqtt")]
mod mqtt;
mod participation;

use iota_sdk::{
client::{
Expand Down
48 changes: 48 additions & 0 deletions sdk/tests/client/node_api/participation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use iota_sdk::types::api::plugins::participation::types::ParticipationEventType;

use crate::client::common::setup_client_with_node_health_ignored;

#[ignore]
#[tokio::test]
async fn test_get_all_events() {
let client = setup_client_with_node_health_ignored().await;
let response = client.events(None).await.unwrap();

for event_id in response.event_ids.iter() {
let event = client.event(event_id).await.unwrap();
println!("{:?}", event);
let status = client.event_status(event_id, None).await.unwrap();
println!("{:?}", status);
}
}

#[ignore]
#[tokio::test]
async fn test_get_voting_events() {
let client = setup_client_with_node_health_ignored().await;
let response = client.events(Some(ParticipationEventType::Voting)).await.unwrap();
for event_id in response.event_ids.iter() {
let event = client.event(event_id).await.unwrap();
println!("{:?}", event);
let status = client.event_status(event_id, None).await.unwrap();
println!("{:?}", status);
}
}

#[ignore]
#[tokio::test]
async fn test_get_staking_events() {
let client = setup_client_with_node_health_ignored().await;
let response = client.events(Some(ParticipationEventType::Staking)).await.unwrap();
for event_id in response.event_ids.iter() {
let event = client.event(event_id).await.unwrap();
println!("{:?}", event);
let status = client.event_status(event_id, None).await.unwrap();
println!("{:?}", status);

client.address_staking_status(bech32_address)

Check failure on line 46 in sdk/tests/client/node_api/participation.rs

View workflow job for this annotation

GitHub Actions / crate (ubuntu-latest)

cannot find value `bech32_address` in this scope

Check failure on line 46 in sdk/tests/client/node_api/participation.rs

View workflow job for this annotation

GitHub Actions / crate (windows-latest)

cannot find value `bech32_address` in this scope

Check failure on line 46 in sdk/tests/client/node_api/participation.rs

View workflow job for this annotation

GitHub Actions / crate (ubuntu-latest)

cannot find value `bech32_address` in this scope

Check failure on line 46 in sdk/tests/client/node_api/participation.rs

View workflow job for this annotation

GitHub Actions / Check Unused Dependencies

cannot find value `bech32_address` in this scope
}
}

0 comments on commit 926980d

Please sign in to comment.