mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-04 05:47:23 +00:00
Use tokio instead of async-std (#495)
* examples: Use tokio instead of std async Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * test-runtime: Use tokio instead of std async Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * subxt: Use tokio instead of std async Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * examples: Use only necessary tokio features Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -36,7 +36,7 @@ use sp_runtime::{
|
||||
};
|
||||
use subxt::Error;
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn tx_basic_transfer() -> Result<(), subxt::Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let bob = pair_signer(AccountKeyring::Bob.pair());
|
||||
@@ -95,7 +95,7 @@ async fn tx_basic_transfer() -> Result<(), subxt::Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn multiple_transfers_work_nonce_incremented(
|
||||
) -> Result<(), subxt::Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
@@ -133,7 +133,7 @@ async fn multiple_transfers_work_nonce_incremented(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_total_issuance() {
|
||||
let cxt = test_context().await;
|
||||
let total_issuance = cxt
|
||||
@@ -146,7 +146,7 @@ async fn storage_total_issuance() {
|
||||
assert_ne!(total_issuance, 0);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_balance_lock() -> Result<(), subxt::Error<DispatchError>> {
|
||||
let bob = pair_signer(AccountKeyring::Bob.pair());
|
||||
let charlie = AccountKeyring::Charlie.to_account_id();
|
||||
@@ -187,7 +187,7 @@ async fn storage_balance_lock() -> Result<(), subxt::Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn transfer_error() {
|
||||
env_logger::try_init().ok();
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
@@ -226,7 +226,7 @@ async fn transfer_error() {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn transfer_implicit_subscription() {
|
||||
env_logger::try_init().ok();
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
@@ -259,7 +259,7 @@ async fn transfer_implicit_subscription() {
|
||||
);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn constant_existential_deposit() {
|
||||
let cxt = test_context().await;
|
||||
let balances_metadata = cxt.client().metadata().pallet("Balances").unwrap();
|
||||
|
||||
@@ -170,7 +170,7 @@ impl ContractsTestContext {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn tx_instantiate_with_code() {
|
||||
let ctx = ContractsTestContext::init().await;
|
||||
let result = ctx.instantiate_with_code().await;
|
||||
@@ -182,7 +182,7 @@ async fn tx_instantiate_with_code() {
|
||||
);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn tx_instantiate() {
|
||||
let ctx = ContractsTestContext::init().await;
|
||||
let (code_hash, _) = ctx.instantiate_with_code().await.unwrap();
|
||||
@@ -196,7 +196,7 @@ async fn tx_instantiate() {
|
||||
);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn tx_call() {
|
||||
let cxt = ContractsTestContext::init().await;
|
||||
let (_, contract) = cxt.instantiate_with_code().await.unwrap();
|
||||
|
||||
@@ -47,7 +47,7 @@ fn default_validator_prefs() -> ValidatorPrefs {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn validate_with_controller_account() {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let ctx = test_context().await;
|
||||
@@ -63,7 +63,7 @@ async fn validate_with_controller_account() {
|
||||
.expect("should be successful");
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn validate_not_possible_for_stash_account() -> Result<(), Error<DispatchError>> {
|
||||
let alice_stash = pair_signer(get_from_seed("Alice//stash"));
|
||||
let ctx = test_context().await;
|
||||
@@ -83,7 +83,7 @@ async fn validate_not_possible_for_stash_account() -> Result<(), Error<DispatchE
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn nominate_with_controller_account() {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let bob = pair_signer(AccountKeyring::Bob.pair());
|
||||
@@ -101,7 +101,7 @@ async fn nominate_with_controller_account() {
|
||||
.expect("should be successful");
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn nominate_not_possible_for_stash_account() -> Result<(), Error<DispatchError>> {
|
||||
let alice_stash = pair_signer(get_from_seed("Alice//stash"));
|
||||
let bob = pair_signer(AccountKeyring::Bob.pair());
|
||||
@@ -124,7 +124,7 @@ async fn nominate_not_possible_for_stash_account() -> Result<(), Error<DispatchE
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn chill_works_for_controller_only() -> Result<(), Error<DispatchError>> {
|
||||
let alice_stash = pair_signer(get_from_seed("Alice//stash"));
|
||||
let bob_stash = pair_signer(get_from_seed("Bob//stash"));
|
||||
@@ -180,7 +180,7 @@ async fn chill_works_for_controller_only() -> Result<(), Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn tx_bond() -> Result<(), Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let ctx = test_context().await;
|
||||
@@ -222,7 +222,7 @@ async fn tx_bond() -> Result<(), Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_history_depth() -> Result<(), Error<DispatchError>> {
|
||||
let ctx = test_context().await;
|
||||
let history_depth = ctx.api.storage().staking().history_depth(None).await?;
|
||||
@@ -230,7 +230,7 @@ async fn storage_history_depth() -> Result<(), Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_current_era() -> Result<(), Error<DispatchError>> {
|
||||
let ctx = test_context().await;
|
||||
let _current_era = ctx
|
||||
@@ -243,7 +243,7 @@ async fn storage_current_era() -> Result<(), Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_era_reward_points() -> Result<(), Error<DispatchError>> {
|
||||
let cxt = test_context().await;
|
||||
let current_era_result = cxt
|
||||
|
||||
@@ -28,7 +28,7 @@ use sp_keyring::AccountKeyring;
|
||||
type Call = runtime_types::node_runtime::Call;
|
||||
type BalancesCall = runtime_types::pallet_balances::pallet::Call;
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_sudo() -> Result<(), subxt::Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let bob = AccountKeyring::Bob.to_account_id().into();
|
||||
@@ -54,7 +54,7 @@ async fn test_sudo() -> Result<(), subxt::Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn test_sudo_unchecked_weight() -> Result<(), subxt::Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let bob = AccountKeyring::Bob.to_account_id().into();
|
||||
|
||||
@@ -25,7 +25,7 @@ use crate::{
|
||||
use assert_matches::assert_matches;
|
||||
use sp_keyring::AccountKeyring;
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_account() -> Result<(), subxt::Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
|
||||
@@ -41,7 +41,7 @@ async fn storage_account() -> Result<(), subxt::Error<DispatchError>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn tx_remark_with_event() -> Result<(), subxt::Error<DispatchError>> {
|
||||
let alice = pair_signer(AccountKeyring::Alice.pair());
|
||||
let cxt = test_context().await;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use crate::test_context;
|
||||
|
||||
#[async_std::test]
|
||||
#[tokio::test]
|
||||
async fn storage_get_current_timestamp() {
|
||||
let cxt = test_context().await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user