Test refactoring and additions to support API Testing (#205)

* move wallet tests into integration module in advance of further test creation, add v3 API

* rustfmt

* fix return value from incorrect mask supplied

* rustfmt

* rework send request call some

* rustfmt

* more refactoring, turn proxy startup + wallet init into macros

* rustfmt

* move sample requests into subdirectories

* add missing wallet files, change gitignore
This commit is contained in:
Yeastplume
2019-08-13 09:36:21 +01:00
committed by GitHub
parent f8c316a351
commit 62d976f9ef
16 changed files with 1011 additions and 671 deletions
+13 -8
View File
@@ -84,7 +84,7 @@ where
let mut validated = false;
if refresh_from_node {
validated = update_outputs(w, keychain_mask, false);
validated = update_outputs(w, keychain_mask, false)?;
}
Ok((
@@ -116,7 +116,7 @@ where
let mut validated = false;
if refresh_from_node {
validated = update_outputs(w, keychain_mask, false);
validated = update_outputs(w, keychain_mask, false)?;
}
Ok((
@@ -141,7 +141,7 @@ where
let mut validated = false;
if refresh_from_node {
validated = update_outputs(w, keychain_mask, false);
validated = update_outputs(w, keychain_mask, false)?;
}
let wallet_info = updater::retrieve_info(&mut *w, &parent_key_id, minimum_confirmations)?;
@@ -418,7 +418,7 @@ where
K: Keychain + 'a,
{
let parent_key_id = w.parent_key_id();
if !update_outputs(w, keychain_mask, false) {
if !update_outputs(w, keychain_mask, false)? {
return Err(ErrorKind::TransactionCancellationError(
"Can't contact running Grin node. Not Cancelling.",
))?;
@@ -489,7 +489,7 @@ where
C: NodeClient + 'a,
K: Keychain + 'a,
{
update_outputs(w, keychain_mask, true);
update_outputs(w, keychain_mask, true)?;
w.check_repair(keychain_mask, delete_unconfirmed)
}
@@ -528,7 +528,7 @@ fn update_outputs<'a, T: ?Sized, C, K>(
w: &mut T,
keychain_mask: Option<&SecretKey>,
update_all: bool,
) -> bool
) -> Result<bool, Error>
where
T: WalletBackend<'a, C, K>,
C: NodeClient + 'a,
@@ -536,7 +536,12 @@ where
{
let parent_key_id = w.parent_key_id();
match updater::refresh_outputs(&mut *w, keychain_mask, &parent_key_id, update_all) {
Ok(_) => true,
Err(_) => false,
Ok(_) => Ok(true),
Err(e) => {
if let ErrorKind::InvalidKeychainMask = e.kind() {
return Err(e);
}
Ok(false)
}
}
}