-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] #2272: Add tests for 'FindAssetDefinitionById' query #2273
[test] #2272: Add tests for 'FindAssetDefinitionById' query #2273
Conversation
1969079
to
27d52bf
Compare
test_client.submit_blocking(RegisterBox::new(asset_definition.clone()))?; | ||
test_client.submit_blocking(MintBox::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is also worth querying and checking the result
test_client.submit_blocking(RegisterBox::new(asset_definition.clone()))?; | |
test_client.submit_blocking(MintBox::new( | |
test_client.submit_blocking(RegisterBox::new(asset_definition.clone()))?; | |
// Here | |
test_client.submit_blocking(MintBox::new( |
Codecov Report
@@ Coverage Diff @@
## iroha2-dev #2273 +/- ##
==============================================
+ Coverage 64.67% 64.68% +0.01%
==============================================
Files 131 131
Lines 24659 24664 +5
==============================================
+ Hits 15947 15953 +6
+ Misses 8712 8711 -1
Continue to review full report at Codecov.
|
27d52bf
to
ca3670e
Compare
use test_network::Peer as TestPeer; | ||
|
||
#[test] | ||
fn find_asset_definition_by_id() -> Result<()> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not what I asked you to do, I would like to know why you decided not to add the query to an existing test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, now I got you. So I'm going to move this test into the closest module (account.rs) like this:
// Registering accounts
let register_accounts = accounts
.iter()
.skip(1) // Alice has already been registered in genesis
.cloned()
.map(|account_id| RegisterBox::new(Account::new(account_id, [])).into())
.collect::<Vec<_>>();
test_client.submit_all_blocking(register_accounts)?;
// HERE
===> let received_asset_definition = test_client.request(client::asset::definition_by_id(definition_id))?;
===> assert_eq!(received_asset_definition, asset_definition.build());
let mint_asset = accounts
.iter()
.cloned()
.map(|account_id| <Asset as Identifiable>::Id::new(definition_id.clone(), account_id))
.map(|asset_id| MintBox::new(1_u32, asset_id).into())
.collect::<Vec<_>>();
test_client.submit_all_blocking(mint_asset)?;
// HERE AFTER MINTING
===> let received_asset_definition = test_client.request(client::asset::definition_by_id(definition_id))?;
===> assert_eq!(received_asset_definition, asset_definition.build());
let accounts = HashSet::from(accounts);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now realize that this PR only needs to replace FindAllAssetsDefinitions
with FindAssetDefinitionById
in this Torii unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah seems this test needs to replace but its only on the server-side. I also added a new client-side method so I think it also should be tested.
ca3670e
to
4cd57ba
Compare
…' query Signed-off-by: Vladimir Pesterev <pesterev@pm.me>
4cd57ba
to
118dc37
Compare
@appetrosyan I've removed @s8sato I've replaced |
Description of the Change
Add some tests for 'FindAssetDefinitionById' query.
Issue
Resolves #2272
Benefits
It tests the query.
Possible Drawbacks
None