From 2e6564f4e1bab40fdf58929bd7cbbe3938f5f252 Mon Sep 17 00:00:00 2001 From: alexstroke1 Date: Fri, 15 Nov 2024 08:53:06 +0100 Subject: [PATCH] fix revoke test Signed-off-by: Far --- .../iroha_cli_tests/src/iroha_cli/iroha_cli.py | 4 ++-- pytests/iroha_cli_tests/test/conftest.py | 15 ++++++++++++++- .../test/permissions/test_revoke_permissions.py | 14 ++++++-------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pytests/iroha_cli_tests/src/iroha_cli/iroha_cli.py b/pytests/iroha_cli_tests/src/iroha_cli/iroha_cli.py index dabea7fe994..bf7a8e7433a 100644 --- a/pytests/iroha_cli_tests/src/iroha_cli/iroha_cli.py +++ b/pytests/iroha_cli_tests/src/iroha_cli/iroha_cli.py @@ -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) diff --git a/pytests/iroha_cli_tests/test/conftest.py b/pytests/iroha_cli_tests/test/conftest.py index ae11957dcf6..a048486e803 100644 --- a/pytests/iroha_cli_tests/test/conftest.py +++ b/pytests/iroha_cli_tests/test/conftest.py @@ -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(): @@ -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(): @@ -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( diff --git a/pytests/iroha_cli_tests/test/permissions/test_revoke_permissions.py b/pytests/iroha_cli_tests/test/permissions/test_revoke_permissions.py index cd96058a653..803ac4c071d 100644 --- a/pytests/iroha_cli_tests/test/permissions/test_revoke_permissions.py +++ b/pytests/iroha_cli_tests/test/permissions/test_revoke_permissions.py @@ -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()) \ No newline at end of file