Enable tests for fixed functionality

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2022-11-22 17:56:58 +03:00 committed by abereziny
parent 69efc2fcce
commit 08274d4620
3 changed files with 22 additions and 16 deletions

View file

@ -207,10 +207,7 @@ def test_static_session_read(
@pytest.mark.static_session @pytest.mark.static_session
@pytest.mark.parametrize( @pytest.mark.parametrize(
"method_under_test,verb", "method_under_test,verb",
[ [(get_range, RANGE_VERB), (get_range_hash, RANGEHASH_VERB)],
(get_range, RANGE_VERB),
# (get_range_hash, RANGEHASH_VERB), session is absent in neofs-cli object hash command (see https://github.com/nspcc-dev/neofs-node/issues/2029)
],
) )
def test_static_session_range( def test_static_session_range(
user_wallet: WalletFile, user_wallet: WalletFile,
@ -487,10 +484,10 @@ def test_static_session_expiration_at_next(
request: FixtureRequest, request: FixtureRequest,
): ):
""" """
Validate static session expires which at next epoch Validate static session which expires at next epoch
""" """
allure.dynamic.title( allure.dynamic.title(
f"Validate static session expires which at next epoch for {request.node.callspec.id}" f"Validate static session which expires at next epoch for {request.node.callspec.id}"
) )
epoch = ensure_fresh_epoch(client_shell) epoch = ensure_fresh_epoch(client_shell)
@ -540,7 +537,7 @@ def test_static_session_start_at_next(
container = owner_wallet.containers[0] container = owner_wallet.containers[0]
object_id = storage_objects[0].oid object_id = storage_objects[0].oid
expiration = Lifetime(epoch + 10, epoch + 1, epoch) expiration = Lifetime(epoch + 2, epoch + 1, epoch)
token_start_at_next_epoch = get_object_signed_token( token_start_at_next_epoch = get_object_signed_token(
owner_wallet, owner_wallet,
@ -562,6 +559,12 @@ def test_static_session_start_at_next(
user_wallet.path, container, object_id, client_shell, session=token_start_at_next_epoch user_wallet.path, container, object_id, client_shell, session=token_start_at_next_epoch
) )
tick_epoch(client_shell)
with pytest.raises(Exception, match=MALFORMED_REQUEST):
head_object(
user_wallet.path, container, object_id, client_shell, session=token_start_at_next_epoch
)
@allure.title("Validate static session which is already expired") @allure.title("Validate static session which is already expired")
@pytest.mark.static_session @pytest.mark.static_session

View file

@ -35,7 +35,7 @@ neo-mamba==0.10.0
neo3crypto==0.2.1 neo3crypto==0.2.1
neo3vm==0.9.0 neo3vm==0.9.0
neo3vm-stubs==0.9.0 neo3vm-stubs==0.9.0
neofs-testlib==0.5.0 neofs-testlib==0.6.0
netaddr==0.8.0 netaddr==0.8.0
orjson==3.6.8 orjson==3.6.8
packaging==21.3 packaging==21.3

View file

@ -82,21 +82,23 @@ def get_range_hash(
endpoint: Optional[str] = None, endpoint: Optional[str] = None,
wallet_config: Optional[str] = None, wallet_config: Optional[str] = None,
xhdr: Optional[dict] = None, xhdr: Optional[dict] = None,
session: Optional[str] = None,
): ):
""" """
GETRANGEHASH of given Object. GETRANGEHASH of given Object.
Args: Args:
wallet (str): wallet on whose behalf GETRANGEHASH is done wallet: wallet on whose behalf GETRANGEHASH is done
cid (str): ID of Container where we get the Object from cid: ID of Container where we get the Object from
oid (str): Object ID oid: Object ID
shell: executor for cli command shell: executor for cli command
bearer (optional, str): path to Bearer Token file, appends to `--bearer` key bearer: path to Bearer Token file, appends to `--bearer` key
range_cut (str): Range to take hash from in the form offset1:length1,..., range_cut: Range to take hash from in the form offset1:length1,...,
value to pass to the `--range` parameter value to pass to the `--range` parameter
endpoint (optional, str): NeoFS endpoint to send request to, appends to `--rpc-endpoint` key endpoint: NeoFS endpoint to send request to, appends to `--rpc-endpoint` key
wallet_config(optional, str): path to the wallet config wallet_config: path to the wallet config
xhdr (optional, dict): Request X-Headers in form of Key=Value xhdr: Request X-Headers in form of Key=Values
session: Filepath to a JSON- or binary-encoded token of the object RANGEHASH session.
Returns: Returns:
None None
""" """
@ -110,6 +112,7 @@ def get_range_hash(
range=range_cut, range=range_cut,
bearer=bearer, bearer=bearer,
xhdr=xhdr, xhdr=xhdr,
session=session,
) )
# cutting off output about range offset and length # cutting off output about range offset and length