Skip to content

Commit

Permalink
fix revoke test
Browse files Browse the repository at this point in the history
Signed-off-by: Far <[email protected]>
  • Loading branch information
alexstroke1 authored and Far committed Nov 15, 2024
1 parent c577162 commit 2e6564f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pytests/iroha_cli_tests/src/iroha_cli/iroha_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ def revoke_permission(self, destination, permission):
:rtype: IrohaCli
"""
changes = {
("Revoke", "Permission", "object"): str(permission),
("Revoke", "Destination", "object"): str(destination),
("Revoke", "Permission", "object", "name"): str(permission),
("Revoke", "Permission", "destination"): str(destination),
}
temp_file_path = self._read_and_update_json("revoke_permission.json", changes)
self._execute_isi(temp_file_path)
Expand Down
15 changes: 14 additions & 1 deletion pytests/iroha_cli_tests/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ def GIVEN_registered_account(GIVEN_registered_domain, GIVEN_public_key):
iroha_cli.register().account(signatory=account.signatory, domain=account.domain)
return account

@pytest.fixture()
def GIVEN_registered_account_granted_with_CanSetParameters(
GIVEN_registered_account, GIVEN_currently_authorized_account
):
"""Fixture to create an account granted with CanSetParameter."""
with allure.step(
f'GIVEN "{GIVEN_registered_account}" granted with permission CanSetParameters'
):
iroha_cli.grant_permission(
destination=GIVEN_registered_account,
permission='CanSetParameters'
)
return GIVEN_registered_account

@pytest.fixture()
def GIVEN_currently_authorized_account():
Expand Down Expand Up @@ -218,6 +231,7 @@ def GIVEN_registered_asset_definition_with_store_type(
return asset_def



# Fixtures for generating various types of data (strings, keys, names, etc.)
@pytest.fixture()
def GIVEN_fake_name():
Expand Down Expand Up @@ -273,7 +287,6 @@ def GIVEN_random_invalid_base64_character():
with allure.step(f'GIVEN a "{letter}" name'):
return letter


# Fixtures for providing specific values or conditions (e.g., name length, string with spaces)
@pytest.fixture()
def GIVEN_key_with_invalid_character_in_key(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@ def story_account_unregisters_asset():

@allure.label("sdk_test_id", "revoke_permission")
@allure.label("permission", "no_permission_required")
@pytest.mark.xfail(reason="")
def test_revoke_permission(
GIVEN_registered_account,
GIVEN_account_granted_with_CanSetParameters,
GIVEN_registered_account_granted_with_CanSetParameters,
GIVEN_currently_authorized_account
):
with allure.step(
f'WHEN "{GIVEN_currently_authorized_account}" revokes '
f'the account "{GIVEN_registered_account}" with permission CanSetParameters'
f'WHEN "{GIVEN_currently_authorized_account}" revokes CanSetParameters'
f'from the "{GIVEN_registered_account_granted_with_CanSetParameters}"'
):
iroha_cli.grant_permission(
destination=GIVEN_registered_account,
iroha_cli.revoke_permission(
destination=GIVEN_registered_account_granted_with_CanSetParameters,
permission='CanSetParameters'
)

with allure.step(
f'THEN the account "{GIVEN_registered_account}" should have the revoked permission'
f'THEN the account "{GIVEN_registered_account_granted_with_CanSetParameters}" should be revoked'
):
assert iroha_cli.should(have.transaction_hash())

0 comments on commit 2e6564f

Please sign in to comment.