Skip to content

Commit

Permalink
extends the test
Browse files Browse the repository at this point in the history
  • Loading branch information
gangov committed Sep 5, 2024
1 parent 6be95db commit bb10236
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion contracts/collections/src/test/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ fn safe_transfer_from_should_fail_when_user_is_not_authorized() {
let collections_client = initialize_collection_contract(&env, Some(&admin), None, None);

// admin mints himself a new NFT
collections_client.mint(&admin, &admin, &1, &1);
collections_client.mint(&admin, &admin, &1, &2);
// admin sets operator to be able to do as they like with the NFT
collections_client.set_approval_for_transfer(&operator, &true);

Expand All @@ -645,4 +645,12 @@ fn safe_transfer_from_should_fail_when_user_is_not_authorized() {
// but they can transfer
collections_client.safe_transfer_from(&operator, &admin, &rcpt, &1, &1);
assert_eq!(collections_client.balance_of(&rcpt, &1), 1);

// admin revokes rights
collections_client.set_approval_for_transfer(&operator, &false);

assert_eq!(
collections_client.try_safe_transfer_from(&operator, &admin, &rcpt, &1, &1),
Err(Ok(ContractError::Unauthorized))
);
}

0 comments on commit bb10236

Please sign in to comment.