forked from TrueCloudLab/frostfs-testcases
[#271] Migrate eACL tests to APE
Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
parent
6e4c3c33a5
commit
fe17f2236b
20 changed files with 1133 additions and 1946 deletions
17
pytest_tests/helpers/bearer_token.py
Normal file
17
pytest_tests/helpers/bearer_token.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import os
|
||||
|
||||
from frostfs_testlib.cli.frostfs_cli.cli import FrostfsCli
|
||||
from frostfs_testlib.storage.dataclasses import ape
|
||||
from frostfs_testlib.utils import string_utils
|
||||
|
||||
|
||||
def create_bearer_token(frostfs_cli: FrostfsCli, directory: str, cid: str, rule: ape.Rule, endpoint: str) -> str:
|
||||
chain_file = os.path.join(directory, string_utils.unique_name("chain-", ".json"))
|
||||
bearer_token_file = os.path.join(directory, string_utils.unique_name("bt-", ".json"))
|
||||
signed_bearer_token_file = os.path.join(directory, string_utils.unique_name("bt-sign-", ".json"))
|
||||
|
||||
frostfs_cli.bearer.generate_ape_override(rule.chain_id, rule=rule.as_string(), cid=cid, output=chain_file)
|
||||
frostfs_cli.bearer.create(endpoint, bearer_token_file, issued_at=1, expire_at=9999, ape=chain_file)
|
||||
frostfs_cli.util.sign_bearer_token(bearer_token_file, signed_bearer_token_file)
|
||||
|
||||
return signed_bearer_token_file
|
Loading…
Add table
Add a link
Reference in a new issue