From 7fcbdb6c34b4072138c0640a1e66a91b2f70a56a Mon Sep 17 00:00:00 2001 From: Vladimir Avdeev Date: Tue, 18 Oct 2022 13:39:39 +0300 Subject: [PATCH] Rename bearer_token to bearer Signed-off-by: Vladimir Avdeev --- .../acl/storage_group/test_storagegroup.py | 10 +++--- pytest_tests/testsuites/acl/test_bearer.py | 12 +++---- .../testsuites/acl/test_eacl_filters.py | 26 +++++++-------- robot/resources/lib/python_keywords/acl.py | 4 +-- .../python_keywords/complex_object_actions.py | 6 ++-- .../lib/python_keywords/neofs_verbs.py | 12 +++---- .../lib/python_keywords/object_access.py | 4 +-- .../lib/python_keywords/storage_group.py | 32 +++++++++---------- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py b/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py index 529bd9ea..d4485e61 100644 --- a/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py +++ b/pytest_tests/testsuites/acl/storage_group/test_storagegroup.py @@ -165,19 +165,19 @@ class TestStorageGroup: obj_list: list, object_size: int, shell: Shell, - bearer_token: Optional[str] = None, + bearer: Optional[str] = None, ): """ This func verifies if the Object's owner is allowed to Put, List, Get and Delete the Storage Group which contains the Object. """ - storage_group = put_storagegroup(wallet, cid, obj_list, bearer_token) - verify_list_storage_group(wallet, cid, storage_group, bearer_token) + storage_group = put_storagegroup(wallet, cid, obj_list, bearer) + verify_list_storage_group(wallet, cid, storage_group, bearer) verify_get_storage_group( - wallet, cid, storage_group, obj_list, object_size, shell, bearer_token + wallet, cid, storage_group, obj_list, object_size, shell, bearer ) - delete_storagegroup(wallet, cid, storage_group, bearer_token) + delete_storagegroup(wallet, cid, storage_group, bearer) @staticmethod @allure.step("Run Storage Group Operations And Expect Failure") diff --git a/pytest_tests/testsuites/acl/test_bearer.py b/pytest_tests/testsuites/acl/test_bearer.py index 87ff6a61..42a50e8f 100644 --- a/pytest_tests/testsuites/acl/test_bearer.py +++ b/pytest_tests/testsuites/acl/test_bearer.py @@ -49,7 +49,7 @@ class TestACLBearer: wait_for_cache_expired() with allure.step(f"Create bearer token for {role.value} with all operations allowed"): - bearer_token = form_bearertoken_file( + bearer = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -79,7 +79,7 @@ class TestACLBearer: cid, objects_oids.pop(), file_path, - bearer=bearer_token, + bearer=bearer, wallet_config=deny_wallet.config_path, shell=client_shell, ) @@ -179,7 +179,7 @@ class TestACLBearer: ) with allure.step("Check rule consistency using bearer token"): - bearer_token_user = form_bearertoken_file( + bearer_user = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -189,7 +189,7 @@ class TestACLBearer: shell=client_shell, ) - bearer_token_other = form_bearertoken_file( + bearer_other = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -205,7 +205,7 @@ class TestACLBearer: objects_oids.pop(), file_path, deny_operations=deny_map_with_bearer[EACLRole.USER], - bearer=bearer_token_user, + bearer=bearer_user, wallet_config=user_wallet.config_path, shell=client_shell, ) @@ -215,7 +215,7 @@ class TestACLBearer: objects_oids.pop(), file_path, deny_operations=deny_map_with_bearer[EACLRole.OTHERS], - bearer=bearer_token_other, + bearer=bearer_other, wallet_config=other_wallet.config_path, shell=client_shell, ) diff --git a/pytest_tests/testsuites/acl/test_eacl_filters.py b/pytest_tests/testsuites/acl/test_eacl_filters.py index e9a3e1ab..0c860cc3 100644 --- a/pytest_tests/testsuites/acl/test_eacl_filters.py +++ b/pytest_tests/testsuites/acl/test_eacl_filters.py @@ -193,7 +193,7 @@ class TestEACLFilters: "Check other has full access when sending request " "with denied headers and using bearer token" ): - bearer_token_other = form_bearertoken_file( + bearer_other = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -209,7 +209,7 @@ class TestEACLFilters: file_path, shell=client_shell, xhdr=deny_headers, - bearer=bearer_token_other, + bearer=bearer_other, ) @pytest.mark.parametrize( @@ -308,7 +308,7 @@ class TestEACLFilters: with allure.step( "Check other have access to objects with deny attribute and using bearer token" ): - bearer_token_other = form_bearertoken_file( + bearer_other = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -328,7 +328,7 @@ class TestEACLFilters: file_path, shell=client_shell, xhdr=xhdr, - bearer=bearer_token_other, + bearer=bearer_other, ) allow_attribute = ( @@ -360,7 +360,7 @@ class TestEACLFilters: with allure.step( "Check other can PUT objects with denied attribute and using bearer token" ): - bearer_token_other_for_put = form_bearertoken_file( + bearer_other_for_put = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -378,7 +378,7 @@ class TestEACLFilters: file_path, shell=client_shell, attributes=deny_attribute, - bearer=bearer_token_other_for_put, + bearer=bearer_other_for_put, ) @pytest.mark.parametrize( @@ -451,7 +451,7 @@ class TestEACLFilters: with allure.step( "Check other can get and put objects without attributes and using bearer token" ): - bearer_token_other = form_bearertoken_file( + bearer_other = form_bearertoken_file( user_wallet.wallet_path, cid, [ @@ -469,7 +469,7 @@ class TestEACLFilters: cid, objects_without_header[0], shell=client_shell, - bearer=bearer_token_other, + bearer=bearer_other, ) assert can_get_object( other_wallet.wallet_path, @@ -477,14 +477,14 @@ class TestEACLFilters: objects_without_header[0], file_path, shell=client_shell, - bearer=bearer_token_other, + bearer=bearer_other, ) assert can_put_object( other_wallet.wallet_path, cid, file_path, shell=client_shell, - bearer=bearer_token_other, + bearer=bearer_other, ) with allure.step(f"Check other can get objects with attributes matching the filter"): @@ -523,7 +523,7 @@ class TestEACLFilters: ): oid = deny_objects.pop() assert can_get_head_object( - other_wallet.wallet_path, cid, oid, shell=client_shell, bearer=bearer_token_other + other_wallet.wallet_path, cid, oid, shell=client_shell, bearer=bearer_other ) assert can_get_object( other_wallet.wallet_path, @@ -531,7 +531,7 @@ class TestEACLFilters: oid, file_path, shell=client_shell, - bearer=bearer_token_other, + bearer=bearer_other, ) assert can_put_object( other_wallet.wallet_path, @@ -539,5 +539,5 @@ class TestEACLFilters: file_path, shell=client_shell, attributes=deny_attribute, - bearer=bearer_token_other, + bearer=bearer_other, ) diff --git a/robot/resources/lib/python_keywords/acl.py b/robot/resources/lib/python_keywords/acl.py index 992f7d2e..1b97690f 100644 --- a/robot/resources/lib/python_keywords/acl.py +++ b/robot/resources/lib/python_keywords/acl.py @@ -208,7 +208,7 @@ def form_bearertoken_file( json.dump(eacl_result, eacl_file, ensure_ascii=False, indent=4) logger.info(f"Got these extended ACL records: {eacl_result}") - sign_bearer_token(wif, file_path) + sign_bearer(wif, file_path) return file_path @@ -235,7 +235,7 @@ def eacl_rules(access: str, verbs: list, user: str) -> list[str]: return rules -def sign_bearer_token(wallet_path: str, eacl_rules_file: str) -> None: +def sign_bearer(wallet_path: str, eacl_rules_file: str) -> None: cmd = ( f"{NEOFS_CLI_EXEC} util sign bearer-token --from {eacl_rules_file} " f"--to {eacl_rules_file} --wallet {wallet_path} --config {WALLET_CONFIG} --json" diff --git a/robot/resources/lib/python_keywords/complex_object_actions.py b/robot/resources/lib/python_keywords/complex_object_actions.py index 1bc9b1af..101cc0e1 100644 --- a/robot/resources/lib/python_keywords/complex_object_actions.py +++ b/robot/resources/lib/python_keywords/complex_object_actions.py @@ -27,7 +27,7 @@ def get_link_object( cid: str, oid: str, shell: Shell, - bearer_token: str = "", + bearer: str = "", wallet_config: str = WALLET_CONFIG, ): """ @@ -37,7 +37,7 @@ def get_link_object( cid (str): Container ID which stores the Large Object oid (str): Large Object ID shell: executor for cli command - bearer_token (optional, str): path to Bearer token file + bearer (optional, str): path to Bearer token file wallet_config (optional, str): path to the neofs-cli config file Returns: (str): Link Object ID @@ -54,7 +54,7 @@ def get_link_object( endpoint=node, is_raw=True, is_direct=True, - bearer_token=bearer_token, + bearer=bearer, wallet_config=wallet_config, ) if resp["link"]: diff --git a/robot/resources/lib/python_keywords/neofs_verbs.py b/robot/resources/lib/python_keywords/neofs_verbs.py index 3feb2882..21a6df08 100644 --- a/robot/resources/lib/python_keywords/neofs_verbs.py +++ b/robot/resources/lib/python_keywords/neofs_verbs.py @@ -26,7 +26,7 @@ def get_object( cid: str, oid: str, shell: Shell, - bearer_token: Optional[str] = None, + bearer: Optional[str] = None, write_object: str = "", endpoint: str = "", xhdr: Optional[dict] = None, @@ -42,7 +42,7 @@ def get_object( cid (str): ID of Container where we get the Object from oid (str): Object ID shell: executor for cli command - bearer_token (optional, str): path to Bearer Token file, appends to `--bearer` key + bearer (optional, str): path to Bearer Token file, appends to `--bearer` key write_object (optional, str): path to downloaded file, appends to `--file` key endpoint (optional, str): NeoFS endpoint to send request to, appends to `--rpc-endpoint` key wallet_config(optional, str): path to the wallet config @@ -67,7 +67,7 @@ def get_object( cid=cid, oid=oid, file=file_path, - bearer=bearer_token, + bearer=bearer, no_progress=no_progress, xhdr=xhdr, session=session, @@ -83,7 +83,7 @@ def get_range_hash( oid: str, range_cut: str, shell: Shell, - bearer_token: Optional[str] = None, + bearer: Optional[str] = None, endpoint: Optional[str] = None, wallet_config: Optional[str] = None, xhdr: Optional[dict] = None, @@ -96,7 +96,7 @@ def get_range_hash( cid (str): ID of Container where we get the Object from oid (str): Object ID shell: executor for cli command - bearer_token (optional, str): path to Bearer Token file, appends to `--bearer` key + bearer (optional, str): path to Bearer Token file, appends to `--bearer` key range_cut (str): Range to take hash from in the form offset1:length1,..., value to pass to the `--range` parameter endpoint (optional, str): NeoFS endpoint to send request to, appends to `--rpc-endpoint` key @@ -113,7 +113,7 @@ def get_range_hash( cid=cid, oid=oid, range=range_cut, - bearer=bearer_token, + bearer=bearer, xhdr=xhdr, ) diff --git a/robot/resources/lib/python_keywords/object_access.py b/robot/resources/lib/python_keywords/object_access.py index 308a7e1b..d2de3a40 100644 --- a/robot/resources/lib/python_keywords/object_access.py +++ b/robot/resources/lib/python_keywords/object_access.py @@ -33,7 +33,7 @@ def can_get_object( wallet, cid, oid, - bearer_token=bearer, + bearer=bearer, wallet_config=wallet_config, xhdr=xhdr, shell=shell, @@ -171,7 +171,7 @@ def can_get_range_hash_of_object( wallet, cid, oid, - bearer_token=bearer, + bearer=bearer, range_cut="0:10", wallet_config=wallet_config, xhdr=xhdr, diff --git a/robot/resources/lib/python_keywords/storage_group.py b/robot/resources/lib/python_keywords/storage_group.py index 451aca53..4e7d8bee 100644 --- a/robot/resources/lib/python_keywords/storage_group.py +++ b/robot/resources/lib/python_keywords/storage_group.py @@ -19,7 +19,7 @@ def put_storagegroup( wallet: str, cid: str, objects: list, - bearer_token: str = "", + bearer: str = "", wallet_config: str = WALLET_CONFIG, lifetime: str = "10", ): @@ -31,7 +31,7 @@ def put_storagegroup( wallet (str): path to wallet on whose behalf the SG is created cid (str): ID of Container to put SG to objects (list): list of Object IDs to include into the SG - bearer_token (optional, str): path to Bearer token file + bearer (optional, str): path to Bearer token file wallet_config (optional, str): path to neofs-cli config file Returns: (str): Object ID of created Storage Group @@ -41,7 +41,7 @@ def put_storagegroup( f"--wallet {wallet} --config {wallet_config} " f"storagegroup put --cid {cid} --lifetime {lifetime} " f'--members {",".join(objects)} ' - f'{"--bearer " + bearer_token if bearer_token else ""}' + f'{"--bearer " + bearer if bearer else ""}' ) output = _cmd_run(cmd) oid = output.split("\n")[1].split(": ")[1] @@ -50,7 +50,7 @@ def put_storagegroup( @allure.step("List Storagegroup") def list_storagegroup( - wallet: str, cid: str, bearer_token: str = "", wallet_config: str = WALLET_CONFIG + wallet: str, cid: str, bearer: str = "", wallet_config: str = WALLET_CONFIG ): """ Wrapper for `neofs-cli storagegroup list`. This operation @@ -59,7 +59,7 @@ def list_storagegroup( wallet (str): path to wallet on whose behalf the SGs are listed in the container cid (str): ID of Container to list - bearer_token (optional, str): path to Bearer token file + bearer (optional, str): path to Bearer token file wallet_config (optional, str): path to neofs-cli config file Returns: (list): Object IDs of found Storage Groups @@ -67,7 +67,7 @@ def list_storagegroup( cmd = ( f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} " f"--wallet {wallet} --config {wallet_config} storagegroup list " - f'--cid {cid} {"--bearer " + bearer_token if bearer_token else ""}' + f'--cid {cid} {"--bearer " + bearer if bearer else ""}' ) output = _cmd_run(cmd) # throwing off the first string of output @@ -80,7 +80,7 @@ def get_storagegroup( wallet: str, cid: str, oid: str, - bearer_token: str = "", + bearer: str = "", wallet_config: str = WALLET_CONFIG, ): """ @@ -89,7 +89,7 @@ def get_storagegroup( wallet (str): path to wallet on whose behalf the SG is got cid (str): ID of Container where SG is stored oid (str): ID of the Storage Group - bearer_token (optional, str): path to Bearer token file + bearer (optional, str): path to Bearer token file wallet_config (optional, str): path to neofs-cli config file Returns: (dict): detailed information on the Storage Group @@ -99,7 +99,7 @@ def get_storagegroup( f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} " f"--wallet {wallet} --config {wallet_config} " f"storagegroup get --cid {cid} --id {oid} " - f'{"--bearer " + bearer_token if bearer_token else ""}' + f'{"--bearer " + bearer if bearer else ""}' ) output = _cmd_run(cmd) @@ -126,7 +126,7 @@ def delete_storagegroup( wallet: str, cid: str, oid: str, - bearer_token: str = "", + bearer: str = "", wallet_config: str = WALLET_CONFIG, ): """ @@ -135,7 +135,7 @@ def delete_storagegroup( wallet (str): path to wallet on whose behalf the SG is deleted cid (str): ID of Container where SG is stored oid (str): ID of the Storage Group - bearer_token (optional, str): path to Bearer token file + bearer (optional, str): path to Bearer token file wallet_config (optional, str): path to neofs-cli config file Returns: (str): Tombstone ID of the deleted Storage Group @@ -145,7 +145,7 @@ def delete_storagegroup( f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} " f"--wallet {wallet} --config {wallet_config} " f"storagegroup delete --cid {cid} --id {oid} " - f'{"--bearer " + bearer_token if bearer_token else ""}' + f'{"--bearer " + bearer if bearer else ""}' ) output = _cmd_run(cmd) tombstone_id = output.strip().split("\n")[1].split(": ")[1] @@ -161,7 +161,7 @@ def verify_list_storage_group( wallet_config: str = WALLET_CONFIG, ): storage_groups = list_storagegroup( - wallet, cid, bearer_token=bearer, wallet_config=wallet_config + wallet, cid, bearer=bearer, wallet_config=wallet_config ) assert storagegroup in storage_groups @@ -181,21 +181,21 @@ def verify_get_storage_group( if object_size == COMPLEX_OBJ_SIZE: for obj in obj_list: link_oid = get_link_object( - wallet, cid, obj, shell=shell, bearer_token=bearer, wallet_config=wallet_config + wallet, cid, obj, shell=shell, bearer=bearer, wallet_config=wallet_config ) obj_head = head_object( wallet, cid, link_oid, is_raw=True, - bearer_token=bearer, + bearer=bearer, wallet_config=wallet_config, ) obj_parts = obj_head["header"]["split"]["children"] obj_num = len(obj_list) storagegroup_data = get_storagegroup( - wallet, cid, storagegroup, bearer_token=bearer, wallet_config=wallet_config + wallet, cid, storagegroup, bearer=bearer, wallet_config=wallet_config ) if object_size == SIMPLE_OBJ_SIZE: exp_size = SIMPLE_OBJ_SIZE * obj_num