[#297] Replace @keyword decorator with allure.step

This commit is contained in:
Юлия Ковшова 2022-09-20 18:03:52 +03:00 committed by Julia Kovshova
parent 589197ba72
commit 035175894d
14 changed files with 100 additions and 108 deletions

View file

@ -4,6 +4,7 @@
This module contains keywords that utilize `neofs-cli container` commands.
"""
import allure
import json
from time import sleep
from typing import Optional, Union
@ -12,13 +13,12 @@ import json_transformers
from cli_utils import NeofsCli
from common import NEOFS_ENDPOINT, WALLET_CONFIG
from robot.api import logger
from robot.api.deco import keyword
ROBOT_AUTO_KEYWORDS = False
DEFAULT_PLACEMENT_RULE = "REP 2 IN X CBF 1 SELECT 4 FROM * AS X"
@keyword('Create Container')
@allure.step('Create Container')
def create_container(wallet: str, rule: str = DEFAULT_PLACEMENT_RULE, basic_acl: str = '',
attributes: Optional[dict] = None, session_token: str = '',
session_wallet: str = '', name: str = None, options: dict = None,
@ -84,7 +84,7 @@ def wait_for_container_deletion(wallet: str, cid: str, attempts: int = 30, sleep
raise AssertionError(f'Expected container deleted during {attempts * sleep_interval} sec.')
@keyword('List Containers')
@allure.step('List Containers')
def list_containers(wallet: str) -> list[str]:
"""
A wrapper for `neofs-cli container list` call. It returns all the
@ -100,7 +100,7 @@ def list_containers(wallet: str) -> list[str]:
return output.split()
@keyword('Get Container')
@allure.step('Get Container')
def get_container(wallet: str, cid: str, json_mode: bool = True) -> Union[dict, str]:
"""
A wrapper for `neofs-cli container get` call. It extracts container's
@ -127,7 +127,7 @@ def get_container(wallet: str, cid: str, json_mode: bool = True) -> Union[dict,
return container_info
@keyword('Delete Container')
@allure.step('Delete Container')
# TODO: make the error message about a non-found container more user-friendly
# https://github.com/nspcc-dev/neofs-contract/issues/121
def delete_container(wallet: str, cid: str, force: bool = False) -> None: