Rename bearer_token to bearer
Signed-off-by: Vladimir Avdeev <v.avdeev@yadro.com>
This commit is contained in:
parent
7d54641e54
commit
7fcbdb6c34
8 changed files with 53 additions and 53 deletions
|
@ -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")
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"]:
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue