forked from hyperledger-iroha/iroha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] hyperledger-iroha#2105: handle query errors in client (hype…
…rledger-iroha#2160) Signed-off-by: 0x009922 <[email protected]>
- Loading branch information
1 parent
f84f6e1
commit 1427045
Showing
5 changed files
with
164 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#![allow(clippy::restriction)] | ||
|
||
use std::str::FromStr; | ||
|
||
use iroha_client::client::{self, ClientQueryError}; | ||
use iroha_core::smartcontracts::{isi::query::Error as QueryError, FindError}; | ||
use iroha_data_model::prelude::*; | ||
|
||
#[test] | ||
fn non_existent_account_is_specific_error() { | ||
let (_rt, _peer, client) = <test_network::Peer>::start_test_with_runtime(); | ||
// we can not wait for genesis committment | ||
|
||
let err = client | ||
.request(client::account::by_id( | ||
AccountId::from_str("john_doe@regalia").unwrap(), | ||
)) | ||
.expect_err("Should error"); | ||
|
||
match err { | ||
ClientQueryError::QueryError(QueryError::Find(err)) => match *err { | ||
FindError::Domain(id) => assert_eq!(id.name.as_ref(), "regalia"), | ||
x => panic!("FindError::Domain expected, got {:?}", x), | ||
}, | ||
x => panic!("Unexpected error: {:?}", x), | ||
}; | ||
} |