diff --git a/client_cli/README.md b/client_cli/README.md index f0fbd77a426..52e8a7e37d2 100644 --- a/client_cli/README.md +++ b/client_cli/README.md @@ -133,15 +133,15 @@ To know how many units of a particular asset an account has, use `asset get` wit This query returns the quantity of `XOR#Soramitsu` asset for the `White Rabbit@Soramitsu` account. -It's possible to filter based on account, asset, domain id by using filtering api provided by client cli. +It's possible to filter based on either account, asset or domain id by using the filtering API provided by the Iroha client CLI. Generally it looks like this: ```bash -./iroha_clien_cli ENTITY list filter PREDICATE +./iroha_client_cli ENTITY list filter PREDICATE ``` -Where ENTITY is asset, account or domain and PREDICATE is condition used for filtering serialized using JSON (check ValuePredicate and GenericPredicateBox in [schema](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/schema.json) for reference). +Where ENTITY is asset, account or domain and PREDICATE is condition used for filtering serialized using JSON (check `ValuePredicate` and `GenericPredicateBox` in [schema](https://github.com/hyperledger/iroha/blob/iroha2-dev/docs/source/references/schema.json) for reference). Examples: @@ -151,7 +151,7 @@ Examples: # Filter accounts by domain ./iroha_client_cli account list filter '{"Identifiable": {"EndsWith": "@wonderland"}}' # It is possible to combine filters using "Or" or "And" -# Filter asset by it's domain id +# Filter asset by domain ./iroha_client_cli asset list filter '{"Or": [{"Identifiable": {"Contains": "#wonderland#"}}, {"And": [{"Identifiable": {"Contains": "##"}}, {"Identifiable": {"EndsWith": "@wonderland"}}]}]}' ``` diff --git a/client_cli/pytests/common/consts.py b/client_cli/pytests/common/consts.py index cdc4b873798..53bf84cb741 100644 --- a/client_cli/pytests/common/consts.py +++ b/client_cli/pytests/common/consts.py @@ -17,7 +17,7 @@ class Stderr(Enum): CANNOT_BE_EMPTY = 'cannot be empty\n\nFor more information try --help\n' REPETITION = 'Repetition' TOO_LONG = 'Name length violation' - FAILED_TO_FIND_DOMAIN = 'Failed to find domain' + FAILED_TO_FIND_DOMAIN = 'Entity missing' INVALID_CHARACTER = 'Invalid character' INVALID_VALUE_TYPE = 'Matching variant not found' RESERVED_CHARACTER = 'The `@` character is reserved for `account@domain` constructs, `#` — for `asset#domain` and `$` — for `trigger$domain`' diff --git a/client_cli/pytests/src/client_cli/client_cli.py b/client_cli/pytests/src/client_cli/client_cli.py index a5a992d2398..f873a29bfd4 100644 --- a/client_cli/pytests/src/client_cli/client_cli.py +++ b/client_cli/pytests/src/client_cli/client_cli.py @@ -4,7 +4,7 @@ """ import json import subprocess -from time import sleep, time +from time import sleep, monotonic from typing import Callable import allure @@ -18,6 +18,9 @@ class ClientCli: A class to represent the Iroha client command line interface. """ BASE_PATH = CLIENT_CLI_PATH + # --skip-mst-check flag is used because + # MST isn't used in the tests + # and don't using this flag results in tests being broken by interactive prompt BASE_FLAGS = ['--config=' + PATH_CONFIG_CLIENT_CLI, '--skip-mst-check'] def __init__(self, config: Config): @@ -48,36 +51,21 @@ def __exit__(self, exc_type, exc_val, exc_tb): """ self.reset() - def wait_for(self, expected: str, actual_call: Callable[[], str], timeout=None): + def wait_for(self, condition: Callable[[], bool], timeout=None): """ Wait for a certain condition to be met, specified by the expected and actual values. - :param expected: The expected value. - :type expected: str - :param actual: The actual value. - :type actual: str + :param condition: Condition that should be met in given time. + :type condition: Callable[[], bool] :param timeout: Maximum time to wait for the condition to be met, defaults to None. :type timeout: int, optional """ timeout = timeout or self._timeout - start_time = time() - actual = actual_call() - while expected not in actual: - if time() - start_time > timeout: - allure.attach( - json.dumps(actual), - name='actual', - attachment_type=allure.attachment_type.JSON) - allure.attach( - json.dumps(expected), - name='expected', - attachment_type=allure.attachment_type.JSON) - raise TimeoutError(f"Expected '{expected}' " - f"to be in '{actual}' " - f"after waiting for '{timeout}' seconds.") + start_time = monotonic() + while not condition(): + if monotonic() - start_time > timeout: + raise TimeoutError(f"Expected condition to be satisfied after waiting for '{timeout}' seconds.") sleep(1) - actual = actual_call() - assert expected in actual def reset(self): """ @@ -255,6 +243,14 @@ def execute(self): text=True ) as process: self.stdout, self.stderr = process.communicate() + allure.attach( + self.stdout, + name='stdout', + attachment_type=allure.attachment_type.TEXT) + allure.attach( + self.stderr, + name='stderr', + attachment_type=allure.attachment_type.TEXT) except Exception as exception: raise RuntimeError( f"Error executing command: {command}. " diff --git a/client_cli/pytests/src/client_cli/have.py b/client_cli/pytests/src/client_cli/have.py index f4b43bd24df..3a12fb249d5 100644 --- a/client_cli/pytests/src/client_cli/have.py +++ b/client_cli/pytests/src/client_cli/have.py @@ -2,8 +2,22 @@ This module contains functions for checking expected results in tests. """ +import json +import allure + from src.client_cli import client_cli, iroha, match +def expected_in_actual(expected, actual) -> bool: + allure.attach( + json.dumps(actual), + name='actual', + attachment_type=allure.attachment_type.JSON) + allure.attach( + json.dumps(expected), + name='expected', + attachment_type=allure.attachment_type.JSON) + + return expected in actual def domain(expected): """ @@ -12,9 +26,10 @@ def domain(expected): :param expected: The expected domain object. :return: True if the domain is present, False otherwise. """ - return match.iroha_have_domain( - expected=expected, - actual=lambda: iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected}"}}}}').domains()) + def domain_in_domains() -> bool: + domains = iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected}"}}}}').domains() + return expected_in_actual(expected, domains) + return client_cli.wait_for(domain_in_domains) def account(expected): @@ -24,9 +39,10 @@ def account(expected): :param expected: The expected account object. :return: True if the account is present, False otherwise. """ - return match.iroha_have_account( - expected=expected, - actual=lambda: iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected}"}}}}').accounts()) + def account_in_accounts() -> bool: + accounts = iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected}"}}}}').accounts() + return expected_in_actual(expected, accounts) + return client_cli.wait_for(account_in_accounts) def asset_definition(expected): @@ -37,10 +53,10 @@ def asset_definition(expected): :return: True if the asset definition is present, False otherwise. """ expected_domain = expected.split('#')[1] - return match.iroha_have_asset_definition( - expected=expected, - actual=lambda: iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected_domain}"}}}}').asset_definitions()) - + def asset_definition_in_asset_definitions() -> bool: + asset_definitions = iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected_domain}"}}}}').asset_definitions() + return expected_in_actual(expected, asset_definitions) + return client_cli.wait_for(asset_definition_in_asset_definitions) def asset(expected): """ @@ -49,9 +65,10 @@ def asset(expected): :param expected: The expected asset object. :return: True if the asset is present, False otherwise. """ - return match.iroha_have_asset( - expected=expected, - actual=lambda: iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected}"}}}}').assets()) + def asset_in_assets() -> bool: + assets = iroha.list_filter(f'{{"Identifiable": {{"Is": "{expected}"}}}}').assets() + return expected_in_actual(expected, assets) + return client_cli.wait_for(asset_in_assets) def error(expected): diff --git a/client_cli/pytests/src/client_cli/iroha.py b/client_cli/pytests/src/client_cli/iroha.py index 08b4aea95a2..3ef1a90351f 100644 --- a/client_cli/pytests/src/client_cli/iroha.py +++ b/client_cli/pytests/src/client_cli/iroha.py @@ -47,8 +47,8 @@ def domains(self) -> List[str]: """ Retrieve domains from the Iroha network and return then as list of ids. - :return: The current Iroha object. - :rtype: Iroha + :return: List of domains ids. + :rtype: List[str] """ self._execute_command('domain') domains = json.loads(self.stdout) @@ -59,8 +59,8 @@ def accounts(self) -> List[str]: """ Retrieve accounts from the Iroha network and return them as list of ids. - :return: The current Iroha object. - :rtype: Iroha + :return: List of accounts ids. + :rtype: List[str] """ self._execute_command('account') accounts = json.loads(self.stdout) @@ -71,8 +71,8 @@ def assets(self) -> List[str]: """ Retrieve assets from the Iroha network and return them as list of ids. - :return: The current Iroha object. - :rtype: Iroha + :return: List of assets ids. + :rtype: List[str] """ self._execute_command('asset') assets = json.loads(self.stdout) @@ -84,8 +84,8 @@ def asset_definitions(self) -> Dict[str, str]: Retrieve asset definitions from the Iroha network and return them as map where ids are keys and value types are values - :return: The current Iroha object. - :rtype: Iroha + :return: Dict of asset definitions ids with there value type. + :rtype: Dict[str, str] """ self._execute_command('domain') domains = json.loads(self.stdout) diff --git a/client_cli/pytests/src/client_cli/match.py b/client_cli/pytests/src/client_cli/match.py index 7bda5166c16..4aa9b65cadf 100644 --- a/client_cli/pytests/src/client_cli/match.py +++ b/client_cli/pytests/src/client_cli/match.py @@ -2,62 +2,8 @@ This module provides helper functions for matching expected and actual values in Iroha objects. """ -from typing import Callable import allure -from src.client_cli import client_cli - - -def wait_for(expected, actual): - """ - Waits for the expected value to be present in the actual value. - - :param expected: The expected value. - :param actual: The actual value. - """ - client_cli.wait_for(expected, actual) - - -def iroha_have_domain(expected: str, actual: str): - """ - Checks if Iroha has the expected domain. - - :param expected: The expected domain. - :param actual: The actual domain list. - """ - wait_for(expected, actual) - - -def iroha_have_account(expected: str, actual: str): - """ - Checks if Iroha has the expected account. - - :param expected: The expected account. - :param actual: The actual account list. - """ - wait_for(expected, actual) - - -def iroha_have_asset_definition(expected: str, actual: Callable[[], str]): - """ - Checks if Iroha has the expected asset definition. - - :param expected: The expected asset definition. - :param actual: The actual asset definition list. - """ - wait_for(expected, actual) - - -def iroha_have_asset(expected: str, actual: str): - """ - Checks if Iroha has the expected asset. - - :param expected: The expected asset. - :param actual: The actual asset list. - """ - wait_for(expected, actual) - - def client_cli_have_error(expected: str, actual: str): """ Checks if the command-line client has the expected error. diff --git a/client_cli/pytests/test/__init__.py b/client_cli/pytests/test/__init__.py index 25dd02fee59..1eebe6afb9f 100644 --- a/client_cli/pytests/test/__init__.py +++ b/client_cli/pytests/test/__init__.py @@ -5,11 +5,11 @@ GIVEN_127_lenght_name, GIVEN_128_lenght_name, GIVEN_129_lenght_name, - GIVEN_new_one_existence_account, - GIVEN_existence_asset_definition_with_quantity_value_type, - GIVEN_existence_asset_definition_with_store_value_type, - GIVEN_existence_domain_with_uppercase_letter, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_account, + GIVEN_existing_asset_definition_with_quantity_value_type, + GIVEN_existing_asset_definition_with_store_value_type, + GIVEN_existing_domain_with_uppercase_letter, + GIVEN_new_one_existing_domain, GIVEN_fake_asset_name, GIVEN_fake_name, GIVEN_key_with_invalid_character_in_key, diff --git a/client_cli/pytests/test/accounts/conftest.py b/client_cli/pytests/test/accounts/conftest.py index 9bb6a07c431..b925774b068 100644 --- a/client_cli/pytests/test/accounts/conftest.py +++ b/client_cli/pytests/test/accounts/conftest.py @@ -4,8 +4,8 @@ from test import ( GIVEN_127_lenght_name, GIVEN_129_lenght_name, - GIVEN_new_one_existence_account, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_account, + GIVEN_new_one_existing_domain, GIVEN_fake_name, GIVEN_key_with_invalid_character_in_key, GIVEN_not_existing_name, diff --git a/client_cli/pytests/test/accounts/test_accounts_query_filters.py b/client_cli/pytests/test/accounts/test_accounts_query_filters.py new file mode 100644 index 00000000000..cd76a8a18da --- /dev/null +++ b/client_cli/pytests/test/accounts/test_accounts_query_filters.py @@ -0,0 +1,51 @@ +import json +import allure + +from src.client_cli import iroha, client_cli + +# using existing account to have at least one account in response +def test_filter_by_domain(GIVEN_new_one_existing_account): + def condition(): + domain = GIVEN_new_one_existing_account.domain + with allure.step( + f'WHEN client_cli query accounts ' + f'in the "{domain}" domain'): + accounts = iroha.list_filter(f'{{"Identifiable": {{"EndsWith": "@{domain}"}}}}').accounts() + with allure.step( + f'THEN Iroha should return only accounts with this domain'): + allure.attach( + json.dumps(accounts), + name='accounts', + attachment_type=allure.attachment_type.JSON) + return accounts and all(account.endswith(domain) for account in accounts) + client_cli.wait_for(condition) + +def test_filter_by_account_name(GIVEN_new_one_existing_account): + def condition(): + name = GIVEN_new_one_existing_account.name + with allure.step( + f'WHEN client_cli query accounts with name "{name}"'): + accounts = iroha.list_filter(f'{{"Identifiable": {{"StartsWith": "{name}@"}}}}').accounts() + with allure.step( + f'THEN Iroha should return only accounts with this name'): + allure.attach( + json.dumps(accounts), + name='accounts', + attachment_type=allure.attachment_type.JSON) + return accounts and all(account.startswith(name) for account in accounts) + client_cli.wait_for(condition) + +def test_filter_by_account_id(GIVEN_new_one_existing_account): + def condition(): + account_id = GIVEN_new_one_existing_account.name + "@" + GIVEN_new_one_existing_account.domain + with allure.step( + f'WHEN client_cli query accounts with account id "{account_id}"'): + accounts = iroha.list_filter(f'{{"Identifiable": {{"Is": "{account_id}"}}}}').accounts() + with allure.step( + f'THEN Iroha should return only accounts with this id'): + allure.attach( + json.dumps(accounts), + name='accounts', + attachment_type=allure.attachment_type.JSON) + return accounts and all(account == account_id for account in accounts) + client_cli.wait_for(condition) diff --git a/client_cli/pytests/test/accounts/test_register_accounts.py b/client_cli/pytests/test/accounts/test_register_accounts.py index ee4ad15b5af..c2954337bee 100644 --- a/client_cli/pytests/test/accounts/test_register_accounts.py +++ b/client_cli/pytests/test/accounts/test_register_accounts.py @@ -12,16 +12,16 @@ def story_account_register_account(): @allure.label('sdk_test_id', 'register_account') def test_register_account( GIVEN_fake_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key): with allure.step( f'WHEN client_cli registers the account "{GIVEN_fake_name}" ' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): client_cli.register().account( account=GIVEN_fake_name, - domain=GIVEN_new_one_existence_domain.name, + domain=GIVEN_new_one_existing_domain.name, key=GIVEN_public_key) - registered = GIVEN_fake_name + '@' + GIVEN_new_one_existence_domain.name + registered = GIVEN_fake_name + '@' + GIVEN_new_one_existing_domain.name with allure.step( f'THEN Iroha should have the "{registered}" account'): iroha.should(have.account(registered)) @@ -31,19 +31,19 @@ def test_register_account( @pytest.mark.xfail(reason="TO DO") def test_register_account_with_two_public_keys( GIVEN_fake_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key): assert 0 @allure.label('sdk_test_id', 'register_account_with_empty_name') def test_register_account_with_empty_name( - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key): with allure.step( f'WHEN client_cli tries to register an account with an empty name ' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): - client_cli.register().account(account='', domain=GIVEN_new_one_existence_domain.name, key=GIVEN_public_key) + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): + client_cli.register().account(account='', domain=GIVEN_new_one_existing_domain.name, key=GIVEN_public_key) with allure.step( f'THEN сlient_cli should have the account error: "{Stderr.CANNOT_BE_EMPTY}"'): client_cli.should(have.error(Stderr.CANNOT_BE_EMPTY.value)) @@ -52,17 +52,17 @@ def test_register_account_with_empty_name( @allure.label('sdk_test_id', 'register_account_with_existing_name') def test_register_account_with_existing_name( - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key, - GIVEN_new_one_existence_account): + GIVEN_new_one_existing_account): with allure.step( f'WHEN client_cli tries to register an account ' - f'with the same name "{GIVEN_new_one_existence_domain.name}" ' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): - client_cli.register().account(account=GIVEN_new_one_existence_account.name, domain=GIVEN_new_one_existence_account.domain, - key=GIVEN_new_one_existence_account.public_key) + f'with the same name "{GIVEN_new_one_existing_domain.name}" ' + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): + client_cli.register().account(account=GIVEN_new_one_existing_account.name, domain=GIVEN_new_one_existing_account.domain, + key=GIVEN_new_one_existing_account.public_key) with allure.step( - f'THEN client_cli should have the account error: "{GIVEN_new_one_existence_domain.name}"'): + f'THEN client_cli should have the account error: "{GIVEN_new_one_existing_domain.name}"'): client_cli.should(have.error(Stderr.REPETITION.value)) @@ -84,11 +84,11 @@ def test_register_account_with_invalid_domain( @allure.label('sdk_test_id', 'register_account_with_invalid_character_in_key') def test_register_account_with_invalid_character_in_key( GIVEN_fake_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_key_with_invalid_character_in_key): with allure.step( 'WHEN client_cli tries to register an account with invalid character in the key'): - client_cli.register().account(account=GIVEN_fake_name, domain=GIVEN_new_one_existence_domain.name, + client_cli.register().account(account=GIVEN_fake_name, domain=GIVEN_new_one_existing_domain.name, key=GIVEN_key_with_invalid_character_in_key) with allure.step( 'THEN client_cli should have the error'): @@ -98,13 +98,13 @@ def test_register_account_with_invalid_character_in_key( @allure.label('sdk_test_id', 'register_account_with_max_name') def test_register_account_with_max_name( GIVEN_127_lenght_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key): with allure.step( 'WHEN client_cli register an account with the 127 lenght name'): - client_cli.register().account(account=GIVEN_127_lenght_name, domain=GIVEN_new_one_existence_domain.name, + client_cli.register().account(account=GIVEN_127_lenght_name, domain=GIVEN_new_one_existing_domain.name, key=GIVEN_public_key) - registered = GIVEN_127_lenght_name + '@' + GIVEN_new_one_existence_domain.name + registered = GIVEN_127_lenght_name + '@' + GIVEN_new_one_existing_domain.name with allure.step( f'THEN Iroha should have the "{registered}" account'): iroha.should(have.account(registered)) @@ -114,19 +114,19 @@ def test_register_account_with_max_name( @allure.label('sdk_test_id', 'register_account_with_special_characters') @pytest.mark.xfail(reason="TO DO") def test_register_account_with_special_characters( - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key): assert 0 @allure.label('sdk_test_id', 'register_account_with_long_account_name') def test_register_account_with_long_account_name( - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_129_lenght_name, GIVEN_public_key): with allure.step( 'WHEN client_cli tries to register an account with a name with 129 characters'): - client_cli.register().account(account=GIVEN_129_lenght_name, domain=GIVEN_new_one_existence_domain.name, + client_cli.register().account(account=GIVEN_129_lenght_name, domain=GIVEN_new_one_existing_domain.name, key=GIVEN_public_key) with allure.step( f'THEN client_cli should have the name error: "{Stderr.TOO_LONG}"'): @@ -136,6 +136,6 @@ def test_register_account_with_long_account_name( @pytest.mark.xfail(reason="TO DO") def test_register_account_with_metadata( GIVEN_fake_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_public_key): assert 0 diff --git a/client_cli/pytests/test/accounts/test_set_key_value_pair.py b/client_cli/pytests/test/accounts/test_set_key_value_pair.py index 4a329dd939e..406bf9726b9 100644 --- a/client_cli/pytests/test/accounts/test_set_key_value_pair.py +++ b/client_cli/pytests/test/accounts/test_set_key_value_pair.py @@ -9,14 +9,14 @@ def story_client_change_account_metadata(): @pytest.mark.xfail(reason="TO DO") def test_set_key_value_in_foreign_asset_after_granting_role( GIVEN_currently_authorized_account, - GIVEN_new_one_existence_account, - GIVEN_existence_asset_definition_with_store_value_type): + GIVEN_new_one_existing_account, + GIVEN_existing_asset_definition_with_store_value_type): assert 0 @allure.label('sdk_test_id', 'set_key_value_pair_for_another_account_asset_definition') @pytest.mark.xfail(reason="TO DO") def test_set_key_value_pair_for_another_account_asset_definition( GIVEN_currently_authorized_account, - GIVEN_new_one_existence_account, - GIVEN_existence_asset_definition_with_store_value_type): + GIVEN_new_one_existing_account, + GIVEN_existing_asset_definition_with_store_value_type): assert 0 diff --git a/client_cli/pytests/test/accounts/test_unregister_accounts.py b/client_cli/pytests/test/accounts/test_unregister_accounts.py index 6cc70d16a05..fbb9926776b 100644 --- a/client_cli/pytests/test/accounts/test_unregister_accounts.py +++ b/client_cli/pytests/test/accounts/test_unregister_accounts.py @@ -9,5 +9,5 @@ def story_account_unregister_account(): @allure.label('sdk_test_id', 'unregister_account') @pytest.mark.xfail(reason="TO DO") def test_unregister_account( - GIVEN_new_one_existence_account): + GIVEN_new_one_existing_account): assert 0 diff --git a/client_cli/pytests/test/assets/conftest.py b/client_cli/pytests/test/assets/conftest.py index 8d2da0c75cd..1e71664f7c4 100644 --- a/client_cli/pytests/test/assets/conftest.py +++ b/client_cli/pytests/test/assets/conftest.py @@ -2,10 +2,10 @@ import allure from test import ( - GIVEN_new_one_existence_account, - GIVEN_existence_asset_definition_with_quantity_value_type, - GIVEN_existence_asset_definition_with_store_value_type, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_account, + GIVEN_existing_asset_definition_with_quantity_value_type, + GIVEN_existing_asset_definition_with_store_value_type, + GIVEN_new_one_existing_domain, GIVEN_fake_asset_name, GIVEN_fake_name, GIVEN_public_key, diff --git a/client_cli/pytests/test/assets/test_assets_query_filters.py b/client_cli/pytests/test/assets/test_assets_query_filters.py new file mode 100644 index 00000000000..281be98deb7 --- /dev/null +++ b/client_cli/pytests/test/assets/test_assets_query_filters.py @@ -0,0 +1,54 @@ +import json +import allure + +from src.client_cli import iroha, client_cli + +# using existing account with asset to have at least one in response +def test_filter_by_domain(GIVEN_currently_account_quantity_with_two_quantity_of_asset): + def condition(): + domain = GIVEN_currently_account_quantity_with_two_quantity_of_asset.domain + with allure.step( + f'WHEN client_cli query assets' + f'in the "{domain}" domain'): + assets = iroha.list_filter( + f'{{"Or": [{{"Identifiable": {{"Contains": "#{domain}#"}}}}, {{"And": [{{"Identifiable": {{"Contains": "##"}}}}, {{"Identifiable": {{"EndsWith": "@{domain}"}}}}]}}]}}' + ).assets() + with allure.step( + f'THEN Iroha should return only assets with this domain'): + allure.attach( + json.dumps(assets), + name='assets', + attachment_type=allure.attachment_type.JSON) + return assets and all(f'#{domain}#' in asset or ('##' in asset and f"@{domain}" in asset) for asset in assets) + client_cli.wait_for(condition) + + +def test_filter_by_asset_name(GIVEN_currently_account_quantity_with_two_quantity_of_asset): + def condition(): + name = GIVEN_currently_account_quantity_with_two_quantity_of_asset.name + with allure.step( + f'WHEN client_cli query assets with name "{name}"'): + assets = iroha.list_filter(f'{{"Identifiable": {{"StartsWith": "{name}#"}}}}').assets() + with allure.step( + f'THEN Iroha should return only assets with this name'): + allure.attach( + json.dumps(assets), + name='assets', + attachment_type=allure.attachment_type.JSON) + return assets and all(asset.startswith(name) for asset in assets) + client_cli.wait_for(condition) + +def test_filter_by_asset_id(GIVEN_currently_authorized_account, GIVEN_currently_account_quantity_with_two_quantity_of_asset): + def condition(): + asset_id = GIVEN_currently_account_quantity_with_two_quantity_of_asset.name + "##" + GIVEN_currently_authorized_account.name + "@" + GIVEN_currently_authorized_account.domain + with allure.step( + f'WHEN client_cli query assets with asset id "{asset_id}"'): + assets = iroha.list_filter(f'{{"Identifiable": {{"Is": "{asset_id}"}}}}').assets() + with allure.step( + f'THEN Iroha should return only assets with this id'): + allure.attach( + json.dumps(assets), + name='assets', + attachment_type=allure.attachment_type.JSON) + return assets and all(asset == asset_id for asset in assets) + client_cli.wait_for(condition) diff --git a/client_cli/pytests/test/assets/test_burn_assets.py b/client_cli/pytests/test/assets/test_burn_assets.py index f5c95fb9bfe..7ebcce66ff5 100644 --- a/client_cli/pytests/test/assets/test_burn_assets.py +++ b/client_cli/pytests/test/assets/test_burn_assets.py @@ -10,8 +10,8 @@ def story_client_burn_asset(): @allure.label('sdk_test_id', 'burn_asset_for_account_in_same_domain') @pytest.mark.xfail(reason="TO DO") def test_burn_asset_for_account_in_same_domain( - GIVEN_existence_asset_definition_with_quantity_value_type, - GIVEN_new_one_existence_account, + GIVEN_existing_asset_definition_with_quantity_value_type, + GIVEN_new_one_existing_account, GIVEN_quantity_value): assert 0 @@ -20,8 +20,8 @@ def test_burn_asset_for_account_in_same_domain( @allure.label('permission', 'can_burn_assets_with_definition') @pytest.mark.xfail(reason="TO DO") def test_burn_other_user_asset( - GIVEN_existence_asset_definition_with_quantity_value_type, - GIVEN_new_one_existence_account, + GIVEN_existing_asset_definition_with_quantity_value_type, + GIVEN_new_one_existing_account, GIVEN_quantity_value): assert 0 @@ -41,5 +41,5 @@ def test_not_burn_asset_if_condition_not_met( @allure.label("sdk_test_id", "burn_fixed_asset") @pytest.mark.xfail(reason="TO DO") def test_burn_fixed_asset( - GIVEN_new_one_existence_account): + GIVEN_new_one_existing_account): assert 0 diff --git a/client_cli/pytests/test/assets/test_mint_assets.py b/client_cli/pytests/test/assets/test_mint_assets.py index cf94e9cc8ce..198ddac3ca2 100644 --- a/client_cli/pytests/test/assets/test_mint_assets.py +++ b/client_cli/pytests/test/assets/test_mint_assets.py @@ -10,27 +10,27 @@ def story_account_mint_asset(): @allure.label('sdk_test_id', 'mint_asset_for_account_in_same_domain') def test_mint_asset_for_account_in_same_domain( - GIVEN_existence_asset_definition_with_quantity_value_type, - GIVEN_new_one_existence_account, + GIVEN_existing_asset_definition_with_quantity_value_type, + GIVEN_new_one_existing_account, GIVEN_quantity_value): with allure.step( - f'WHEN client_cli mint the asset "{GIVEN_existence_asset_definition_with_quantity_value_type.name}" ' - f'for the "{GIVEN_new_one_existence_account.name}" ' - f'in the "{GIVEN_existence_asset_definition_with_quantity_value_type.domain}" domain' + f'WHEN client_cli mint the asset "{GIVEN_existing_asset_definition_with_quantity_value_type.name}" ' + f'for the "{GIVEN_new_one_existing_account.name}" ' + f'in the "{GIVEN_existing_asset_definition_with_quantity_value_type.domain}" domain' ): client_cli.mint().asset( - account=GIVEN_new_one_existence_account, - asset_definition=GIVEN_existence_asset_definition_with_quantity_value_type, + account=GIVEN_new_one_existing_account, + asset_definition=GIVEN_existing_asset_definition_with_quantity_value_type, value_of_value_type=GIVEN_quantity_value ) with allure.step( - f'THEN "{GIVEN_new_one_existence_account}" account ' - f'should have the "{GIVEN_existence_asset_definition_with_quantity_value_type}" asset definition'): - iroha.should(have.asset(f'{GIVEN_existence_asset_definition_with_quantity_value_type.name}##{GIVEN_new_one_existence_account}')) + f'THEN "{GIVEN_new_one_existing_account}" account ' + f'should have the "{GIVEN_existing_asset_definition_with_quantity_value_type}" asset definition'): + iroha.should(have.asset(f'{GIVEN_existing_asset_definition_with_quantity_value_type.name}##{GIVEN_new_one_existing_account}')) @allure.label("sdk_test_id", "mint_fixed_asset") @pytest.mark.xfail(reason="TO DO") def test_mint_fixed_asset( - GIVEN_new_one_existence_account): + GIVEN_new_one_existing_account): assert 0 diff --git a/client_cli/pytests/test/assets/test_register_asset_definitions.py b/client_cli/pytests/test/assets/test_register_asset_definitions.py index 8a8bec60bd4..fcd5510750f 100644 --- a/client_cli/pytests/test/assets/test_register_asset_definitions.py +++ b/client_cli/pytests/test/assets/test_register_asset_definitions.py @@ -13,42 +13,42 @@ def story_account_registers_asset_definitions(): @allure.label('sdk_test_id', 'register_asset_definition_with_quantity_value_type') def test_register_asset_definition_with_quantity_value_type( GIVEN_fake_asset_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_quantity_value_type): with allure.step( f'WHEN client_cli registers the asset_definition "{GIVEN_fake_asset_name}" ' f'with "{GIVEN_quantity_value_type}" value type' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): client_cli.register().asset().definition( asset=GIVEN_fake_asset_name, - domain=GIVEN_new_one_existence_domain.name, + domain=GIVEN_new_one_existing_domain.name, value_type=GIVEN_quantity_value_type) with allure.step( f'THEN Iroha should have the asset "{GIVEN_fake_asset_name}"'): - iroha.should(have.asset_definition(GIVEN_fake_asset_name + '#' + GIVEN_new_one_existence_domain.name)) + iroha.should(have.asset_definition(GIVEN_fake_asset_name + '#' + GIVEN_new_one_existing_domain.name)) @allure.label('sdk_test_id', 'register_asset_definition_with_store_value_type') def test_register_asset_definition_with_store_value_type( GIVEN_fake_asset_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_store_value_type): with allure.step( f'WHEN client_cli registers the asset_definition "{GIVEN_fake_asset_name}" ' f'with "{GIVEN_store_value_type}" value type' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): client_cli.register().asset().definition( asset=GIVEN_fake_asset_name, - domain=GIVEN_new_one_existence_domain.name, + domain=GIVEN_new_one_existing_domain.name, value_type=GIVEN_store_value_type) with allure.step( f'THEN Iroha should have the asset "{GIVEN_fake_asset_name}"'): - iroha.should(have.asset_definition(GIVEN_fake_asset_name + '#' + GIVEN_new_one_existence_domain.name)) + iroha.should(have.asset_definition(GIVEN_fake_asset_name + '#' + GIVEN_new_one_existing_domain.name)) @allure.label("sdk_test_id", "register_asset_definition_with_metadata") @pytest.mark.xfail(reason="TO DO") def test_register_asset_definition_with_metadata( GIVEN_fake_asset_name, - GIVEN_new_one_existence_domain): + GIVEN_new_one_existing_domain): assert 0 @@ -56,32 +56,32 @@ def test_register_asset_definition_with_metadata( @pytest.mark.xfail(reason="TO DO") def test_register_fixed_asset_definition( GIVEN_fake_asset_name, - GIVEN_new_one_existence_domain): + GIVEN_new_one_existing_domain): assert 0 @allure.label('sdk_test_id', 'register_asset_with_existing_name') def test_register_asset_with_existing_name( - GIVEN_existence_asset_definition_with_quantity_value_type): + GIVEN_existing_asset_definition_with_quantity_value_type): with allure.step( - f'WHEN client_cli tries to register an asset definition with the same name "{GIVEN_existence_asset_definition_with_quantity_value_type.name}"' - f'in the "{GIVEN_existence_asset_definition_with_quantity_value_type.domain}" domain'): - client_cli.register().asset().definition(asset=GIVEN_existence_asset_definition_with_quantity_value_type.name, - domain=GIVEN_existence_asset_definition_with_quantity_value_type.domain, - value_type=GIVEN_existence_asset_definition_with_quantity_value_type.value_type) + f'WHEN client_cli tries to register an asset definition with the same name "{GIVEN_existing_asset_definition_with_quantity_value_type.name}"' + f'in the "{GIVEN_existing_asset_definition_with_quantity_value_type.domain}" domain'): + client_cli.register().asset().definition(asset=GIVEN_existing_asset_definition_with_quantity_value_type.name, + domain=GIVEN_existing_asset_definition_with_quantity_value_type.domain, + value_type=GIVEN_existing_asset_definition_with_quantity_value_type.value_type) with allure.step( - f'THEN client_cli should have the asset definition error: "{GIVEN_existence_asset_definition_with_quantity_value_type.__repr__()}"'): + f'THEN client_cli should have the asset definition error: "{GIVEN_existing_asset_definition_with_quantity_value_type.__repr__()}"'): client_cli.should(have.error(Stderr.REPETITION.value)) @allure.label('sdk_test_id', 'register_asset_with_empty_name') def test_register_asset_with_empty_name( - GIVEN_new_one_existence_domain): + GIVEN_new_one_existing_domain): with allure.step( f'WHEN client_cli tries to register an asset definition with an empty name' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): - client_cli.register().asset().definition(asset='', domain=GIVEN_new_one_existence_domain.name, value_type='Quantity') + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): + client_cli.register().asset().definition(asset='', domain=GIVEN_new_one_existing_domain.name, value_type='Quantity') with allure.step( f'THEN сlient_cli should have the asset error: "{Stderr.CANNOT_BE_EMPTY}"'): client_cli.should(have.error(Stderr.CANNOT_BE_EMPTY.value)) @@ -90,12 +90,12 @@ def test_register_asset_with_empty_name( @allure.label('sdk_test_id', 'register_asset_with_not_existing_domain') def test_register_asset_with_not_existing_domain( - GIVEN_fake_name, + GIVEN_not_existing_name, GIVEN_quantity_value_type, GIVEN_fake_asset_name): with allure.step( f'WHEN client_cli tries to register an asset definition with not existing domain'): - client_cli.register().asset().definition(asset=GIVEN_fake_asset_name, domain=GIVEN_fake_name, + client_cli.register().asset().definition(asset=GIVEN_fake_asset_name, domain=GIVEN_not_existing_name, value_type=GIVEN_quantity_value_type) with allure.step( f'THEN client_cli should have the error'): @@ -106,11 +106,11 @@ def test_register_asset_with_not_existing_domain( @allure.label('sdk_test_id', 'register_asset_with_too_long_value_type') def test_register_asset_with_too_long_value_type( GIVEN_fake_asset_name, - GIVEN_new_one_existence_domain): + GIVEN_new_one_existing_domain): with allure.step( 'WHEN client_cli tries to register an asset definition with too long value type'): client_cli.register().asset().definition(asset=GIVEN_fake_asset_name, - domain=GIVEN_new_one_existence_domain.name, + domain=GIVEN_new_one_existing_domain.name, value_type='coin') with allure.step( 'THEN client_cli should have the error'): diff --git a/client_cli/pytests/test/assets/test_transfer_assets.py b/client_cli/pytests/test/assets/test_transfer_assets.py index 99c917a0b86..9e694869670 100644 --- a/client_cli/pytests/test/assets/test_transfer_assets.py +++ b/client_cli/pytests/test/assets/test_transfer_assets.py @@ -11,29 +11,29 @@ def story_account_transfer_asset(): @allure.label('sdk_test_id', 'transfer_asset') @allure.label('permission', 'no_permission_required') def test_transfer_asset( - GIVEN_new_one_existence_account, + GIVEN_new_one_existing_account, GIVEN_currently_authorized_account, GIVEN_currently_account_quantity_with_two_quantity_of_asset): with allure.step(f'WHEN {GIVEN_currently_authorized_account.name} transfers 1 Quantity' f'of {GIVEN_currently_account_quantity_with_two_quantity_of_asset.name}' - f'to {GIVEN_new_one_existence_account.name}'): + f'to {GIVEN_new_one_existing_account.name}'): client_cli.transfer( asset=GIVEN_currently_account_quantity_with_two_quantity_of_asset, source_account=GIVEN_currently_authorized_account, - target_account=GIVEN_new_one_existence_account, + target_account=GIVEN_new_one_existing_account, quantity="1") with allure.step(f'THEN {GIVEN_currently_authorized_account.name} has 1 Quantity ' f'of {GIVEN_currently_account_quantity_with_two_quantity_of_asset.name}' - f'AND {GIVEN_new_one_existence_account} has 1 more Quantity'): + f'AND {GIVEN_new_one_existing_account} has 1 more Quantity'): iroha.should(have.asset( - f'{GIVEN_currently_account_quantity_with_two_quantity_of_asset.name}#{GIVEN_currently_authorized_account.domain}#{GIVEN_new_one_existence_account}')) + f'{GIVEN_currently_account_quantity_with_two_quantity_of_asset.name}#{GIVEN_currently_authorized_account.domain}#{GIVEN_new_one_existing_account}')) @allure.label('sdk_test_id', 'transfer_user_asset') @allure.label('permission', 'can_transfer_user_asset') @pytest.mark.xfail(reason="TO DO") def test_transfer_user_asset( - GIVEN_new_one_existence_account, + GIVEN_new_one_existing_account, GIVEN_currently_authorized_account): assert 0 diff --git a/client_cli/pytests/test/assets/test_unregister_asset_definitions.py b/client_cli/pytests/test/assets/test_unregister_asset_definitions.py index 83b661a6721..c3f0ae4eec8 100644 --- a/client_cli/pytests/test/assets/test_unregister_asset_definitions.py +++ b/client_cli/pytests/test/assets/test_unregister_asset_definitions.py @@ -10,5 +10,5 @@ def story_account_unregister_asset_definitions(): @allure.label('sdk_test_id', 'unregister_asset_definition') @pytest.mark.xfail(reason="TO DO") def test_unregister_asset_definition( - GIVEN_existence_asset_definition_with_quantity_value_type): + GIVEN_existing_asset_definition_with_quantity_value_type): assert 0 diff --git a/client_cli/pytests/test/conftest.py b/client_cli/pytests/test/conftest.py index 601b4c7c389..07c691e25b2 100644 --- a/client_cli/pytests/test/conftest.py +++ b/client_cli/pytests/test/conftest.py @@ -21,32 +21,32 @@ def before_each(): # Fixtures for creating objects (domains, accounts, asset definitions, assets) @pytest.fixture() -def GIVEN_new_one_existence_domain(): +def GIVEN_new_one_existing_domain(): """Fixture to create and register an existing domain.""" domain = Domain(fake_name()) - with allure.step(f'GIVEN an existence domain {domain.name}'): + with allure.step(f'GIVEN an existing domain {domain.name}'): client_cli.register().domain(domain.name) return domain @pytest.fixture() -def GIVEN_existence_domain_with_uppercase_letter( - GIVEN_new_one_existence_domain): +def GIVEN_existing_domain_with_uppercase_letter( + GIVEN_new_one_existing_domain): """Fixture to create and register an existing domain, but with uppercase letter.""" - domain = GIVEN_new_one_existence_domain + domain = GIVEN_new_one_existing_domain domain.name = name_with_uppercase_letter(domain.name) - with allure.step(f'GIVEN an existence domain {domain.name}'): + with allure.step(f'GIVEN an existing domain {domain.name}'): client_cli.register().domain(domain.name) return domain @pytest.fixture() -def GIVEN_new_one_existence_account(GIVEN_new_one_existence_domain, GIVEN_public_key): +def GIVEN_new_one_existing_account(GIVEN_new_one_existing_domain, GIVEN_public_key): """Fixture to create and register an existing account.""" + name = fake_name() account = Account( - name=fake_name(), - domain=GIVEN_new_one_existence_domain.name, + name=name, + domain=GIVEN_new_one_existing_domain.name, public_key=GIVEN_public_key) - name = fake_name() - with allure.step(f'GIVEN the account "{name}" in the "{GIVEN_new_one_existence_domain.name}" domain'): + with allure.step(f'GIVEN the account "{name}" in the "{GIVEN_new_one_existing_domain.name}" domain'): client_cli.register().account( account=account.name, domain=account.domain, @@ -72,8 +72,7 @@ def GIVEN_currently_account_quantity_with_two_quantity_of_asset( asset_def = AssetDefinition(name=GIVEN_fake_asset_name, domain=GIVEN_currently_authorized_account.domain, value_type=GIVEN_quantity_value_type) - name = fake_name() - with allure.step(f'GIVEN the asset_definition "{name}" ' + with allure.step(f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' f'in the "{GIVEN_currently_authorized_account.domain}" domain'): client_cli.register().asset().definition( asset=asset_def.name, @@ -89,34 +88,32 @@ def GIVEN_currently_account_quantity_with_two_quantity_of_asset( @pytest.fixture() -def GIVEN_existence_asset_definition_with_quantity_value_type( - GIVEN_new_one_existence_domain, +def GIVEN_existing_asset_definition_with_quantity_value_type( + GIVEN_new_one_existing_domain, GIVEN_quantity_value_type, GIVEN_fake_asset_name): """Fixture to create and register an existing asset definition with random value type.""" asset_def = AssetDefinition(name=GIVEN_fake_asset_name, - domain=GIVEN_new_one_existence_domain.name, + domain=GIVEN_new_one_existing_domain.name, value_type=GIVEN_quantity_value_type) - name = fake_name() - with allure.step(f'GIVEN the asset_definition "{name}" ' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): + with allure.step(f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): client_cli.register().asset().definition(asset=asset_def.name, domain=asset_def.domain, value_type=asset_def.value_type) return asset_def @pytest.fixture() -def GIVEN_existence_asset_definition_with_store_value_type( - GIVEN_new_one_existence_domain, +def GIVEN_existing_asset_definition_with_store_value_type( + GIVEN_new_one_existing_domain, GIVEN_store_value_type, GIVEN_fake_asset_name): """Fixture to create and register an existing asset definition with store value type.""" asset_def = AssetDefinition(name=GIVEN_fake_asset_name, - domain=GIVEN_new_one_existence_domain.name, + domain=GIVEN_new_one_existing_domain.name, value_type=GIVEN_store_value_type) - name = fake_name() - with allure.step(f'GIVEN the asset_definition "{name}" ' - f'in the "{GIVEN_new_one_existence_domain.name}" domain'): + with allure.step(f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' + f'in the "{GIVEN_new_one_existing_domain.name}" domain'): client_cli.register().asset().definition(asset=asset_def.name, domain=asset_def.domain, value_type=asset_def.value_type) @@ -140,9 +137,9 @@ def GIVEN_fake_asset_name(): @pytest.fixture() def GIVEN_not_existing_name(): - """Fixture to provide a non-existent name.""" + """Fixture to provide a non-existing name.""" name = not_existing_name() - with allure.step(f'GIVEN an existence domain {name}'): + with allure.step(f'GIVEN an non-existing {name}'): return name @pytest.fixture() diff --git a/client_cli/pytests/test/domains/conftest.py b/client_cli/pytests/test/domains/conftest.py index 57695fee267..38016b6a130 100644 --- a/client_cli/pytests/test/domains/conftest.py +++ b/client_cli/pytests/test/domains/conftest.py @@ -4,12 +4,12 @@ from test import ( GIVEN_128_lenght_name, GIVEN_129_lenght_name, - GIVEN_new_one_existence_domain, + GIVEN_new_one_existing_domain, GIVEN_fake_name, GIVEN_random_character, GIVEN_string_with_reserved_character, GIVEN_string_with_whitespaces, - GIVEN_existence_domain_with_uppercase_letter, + GIVEN_existing_domain_with_uppercase_letter, before_each) @pytest.fixture(scope="function", autouse=True) diff --git a/client_cli/pytests/test/domains/test_domains_query_filters.py b/client_cli/pytests/test/domains/test_domains_query_filters.py new file mode 100644 index 00000000000..95c7bcb8887 --- /dev/null +++ b/client_cli/pytests/test/domains/test_domains_query_filters.py @@ -0,0 +1,19 @@ +import json +import allure + +from src.client_cli import iroha, client_cli + +def test_filter_by_domain(GIVEN_new_one_existing_domain): + def condition(): + domain_name = GIVEN_new_one_existing_domain.name + with allure.step( + f'WHEN client_cli query domains filtered by name "{domain_name}"'): + domains = iroha.list_filter(f'{{"Identifiable": {{"Is": "{domain_name}"}}}}').domains() + with allure.step( + f'THEN Iroha should return only return domains with "{domain_name}" name'): + allure.attach( + json.dumps(domains), + name='domains', + attachment_type=allure.attachment_type.JSON) + return domains and all(domain == domain_name for domain in domains) + client_cli.wait_for(condition) diff --git a/client_cli/pytests/test/domains/test_register_domains.py b/client_cli/pytests/test/domains/test_register_domains.py index 88542088669..a3982b70957 100644 --- a/client_cli/pytests/test/domains/test_register_domains.py +++ b/client_cli/pytests/test/domains/test_register_domains.py @@ -33,24 +33,24 @@ def test_register_empty_domain( @allure.label('sdk_test_id', 'register_existence_domain') def test_register_existence_domain( - GIVEN_new_one_existence_domain): + GIVEN_new_one_existing_domain): with allure.step( - f'WHEN client_cli registers an existence domain "{GIVEN_new_one_existence_domain.name}"'): - client_cli.register().domain(GIVEN_new_one_existence_domain.name) + f'WHEN client_cli registers an existence domain "{GIVEN_new_one_existing_domain.name}"'): + client_cli.register().domain(GIVEN_new_one_existing_domain.name) with allure.step( - f'THEN client_cli should have the domain error: "{GIVEN_new_one_existence_domain.name}"'): + f'THEN client_cli should have the domain error: "{GIVEN_new_one_existing_domain.name}"'): client_cli.should(have.error(Stderr.REPETITION.value)) @allure.label('sdk_test_id', 'register_existence_domain_with_uppercase_letter') def test_register_existence_domain_uppercase_with_uppercase_letter( - GIVEN_existence_domain_with_uppercase_letter): + GIVEN_existing_domain_with_uppercase_letter): with allure.step( f'WHEN client_cli registers an existence domain, ' - f'but with uppercase letter "{GIVEN_existence_domain_with_uppercase_letter.name}"'): - client_cli.register().domain(GIVEN_existence_domain_with_uppercase_letter.name) + f'but with uppercase letter "{GIVEN_existing_domain_with_uppercase_letter.name}"'): + client_cli.register().domain(GIVEN_existing_domain_with_uppercase_letter.name) with allure.step( - f'THEN Iroha should have the domain name "{GIVEN_existence_domain_with_uppercase_letter.name}"'): - iroha.should(have.domain(GIVEN_existence_domain_with_uppercase_letter.name)) + f'THEN Iroha should have the domain name "{GIVEN_existing_domain_with_uppercase_letter.name}"'): + iroha.should(have.domain(GIVEN_existing_domain_with_uppercase_letter.name)) @allure.label('sdk_test_id', 'register_one_letter_domain') def test_register_one_letter_domain( diff --git a/client_cli/pytests/test/domains/test_unregister_domains.py b/client_cli/pytests/test/domains/test_unregister_domains.py index 8fdec650871..74a9a9269b3 100644 --- a/client_cli/pytests/test/domains/test_unregister_domains.py +++ b/client_cli/pytests/test/domains/test_unregister_domains.py @@ -10,5 +10,5 @@ def story_account_unregister_domain(): @allure.label('sdk_test_id', 'unregister_domain') @pytest.mark.xfail(reason="TO DO") def test_unregister_domain( - GIVEN_new_one_existence_domain): + GIVEN_new_one_existing_domain): assert 0 diff --git a/client_cli/pytests/test/roles/test_register_roles.py b/client_cli/pytests/test/roles/test_register_roles.py index de16653d780..84d5d3a32b6 100644 --- a/client_cli/pytests/test/roles/test_register_roles.py +++ b/client_cli/pytests/test/roles/test_register_roles.py @@ -17,7 +17,7 @@ def test_register_role( @allure.label('sdk_test_id', 'attach_permissions_to_role') @pytest.mark.xfail(reason="TO DO") def test_attach_permissions_to_role( - GIVEN_existence_asset_definition_with_store_value_type): + GIVEN_existing_asset_definition_with_store_value_type): assert 0 @@ -25,6 +25,6 @@ def test_attach_permissions_to_role( @pytest.mark.xfail(reason="TO DO") def test_grant_role_to_account( GIVEN_currently_authorized_account, - GIVEN_new_one_existence_account, - GIVEN_existence_asset_definition_with_store_value_type): + GIVEN_new_one_existing_account, + GIVEN_existing_asset_definition_with_store_value_type): assert 0 diff --git a/configs/peer/validator.wasm b/configs/peer/validator.wasm index 55206a46927..0d9e104d6cf 100644 Binary files a/configs/peer/validator.wasm and b/configs/peer/validator.wasm differ