Skip to content

Commit

Permalink
Merge pull request hyperledger-archives#8 from dastardlychimp/TOK-424
Browse files Browse the repository at this point in the history
Add rust wrapper wallet tests.
  • Loading branch information
mac-arrap authored Sep 28, 2018
2 parents e7dcd5b + b627c83 commit 5df3293
Show file tree
Hide file tree
Showing 4 changed files with 404 additions and 103 deletions.
10 changes: 8 additions & 2 deletions wrappers/rust/tests/did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ use indy::ErrorCode;
use std::sync::mpsc::channel;
use std::time::Duration;
use utils::b58::{FromBase58, IntoBase58};
use utils::constants::{DID_1, SEED_1, VERKEY_1, METADATA, VERKEY_ABV_1};
use utils::constants::{
DID_1,
SEED_1,
VERKEY_1,
METADATA,
VERKEY_ABV_1,
INVALID_HANDLE
};
use utils::setup::{Setup, SetupConfig};
use utils::wallet::Wallet;

const VALID_TIMEOUT: Duration = Duration::from_secs(5);
const INVALID_TIMEOUT: Duration = Duration::from_micros(1);
const INVALID_HANDLE: i32 = 583741;

#[inline]
fn assert_verkey_len(verkey: &str) {
Expand Down
8 changes: 4 additions & 4 deletions wrappers/rust/tests/utils/constants.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pub const DEFAULT_CREDENTIALS: &str = r#"{"key":""}"#;
pub const DID_1: &str = "VsKV7grR1BUE29mG2Fm2kX";
pub const EXPORT_KEY: &str = "export_key";
pub const DID: &str = "8wZcEriaNLNKtteJvx7f8i";
pub const DID_TRUSTEE: &str = "V4SGRU86Z58d6TV7PBUe6f";
pub const INVALID_HANDLE: i32 = 583741;
pub const METADATA: &str = "some_metadata";
pub const MY1_SEED: &str = "00000000000000000000000000000My1";
pub const PROTOCOL_VERSION: i32 = 2;
pub const SEED_1: &str = "00000000000000000000000000000My1";
pub const TRUSTEE_SEED: &str = "000000000000000000000000Trustee1";
pub const VERKEY_1: &str = "GjZWsBLgZCR18aL468JAT7w9CZRiBnpxUPPgyQxh4voa";
pub const VERKEY_ABV_1: &str = "~HYwqs2vrTc8Tn4uBV7NBTe";
pub const DID: &str = "8wZcEriaNLNKtteJvx7f8i";
pub const DID_TRUSTEE: &str = "V4SGRU86Z58d6TV7PBUe6f";
pub const VERKEY_TRUSTEE: &str = "GJ1SzoWzavQYfNL9XkaJdrQejfztN4XqdsiV4ct3LXKL";
pub const METADATA: &str = "some_metadata";
13 changes: 0 additions & 13 deletions wrappers/rust/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,6 @@ pub fn tails_writer_config() -> String {
serde_json::to_string(&c).unwrap()
}

pub fn export_path(wallet_name: &str) -> String {
tmp_file_path(wallet_name).to_str().unwrap().to_string()
}

pub fn export_config_json(wallet_name: &str) -> String {
let e = hashmap![
"key".to_string() => constants::EXPORT_KEY.to_string(),
"path".to_string() => export_path(wallet_name)
];

serde_json::to_string(&e).unwrap()
}

pub fn indy_home_path() -> PathBuf {
let mut path = env::home_dir().unwrap_or(PathBuf::from("/home/indy"));
let mut indy_client_dir = ".indy_client";
Expand Down
Loading

0 comments on commit 5df3293

Please sign in to comment.