From 08274d462013fbe0b1ad3982ac6d058ebbb4bc50 Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Tue, 22 Nov 2022 17:56:58 +0300 Subject: [PATCH] Enable tests for fixed functionality Signed-off-by: Andrey Berezin --- .../test_static_object_session_token.py | 17 ++++++++++------- requirements.txt | 2 +- .../lib/python_keywords/neofs_verbs.py | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/pytest_tests/testsuites/session_token/test_static_object_session_token.py b/pytest_tests/testsuites/session_token/test_static_object_session_token.py index 15f245d..d2ba22c 100644 --- a/pytest_tests/testsuites/session_token/test_static_object_session_token.py +++ b/pytest_tests/testsuites/session_token/test_static_object_session_token.py @@ -207,10 +207,7 @@ def test_static_session_read( @pytest.mark.static_session @pytest.mark.parametrize( "method_under_test,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) - ], + [(get_range, RANGE_VERB), (get_range_hash, RANGEHASH_VERB)], ) def test_static_session_range( user_wallet: WalletFile, @@ -487,10 +484,10 @@ def test_static_session_expiration_at_next( request: FixtureRequest, ): """ - Validate static session expires which at next epoch + Validate static session which expires at next epoch """ 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) @@ -540,7 +537,7 @@ def test_static_session_start_at_next( container = owner_wallet.containers[0] 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( 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 ) + 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") @pytest.mark.static_session diff --git a/requirements.txt b/requirements.txt index b6dc9bd..a908e5d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ neo-mamba==0.10.0 neo3crypto==0.2.1 neo3vm==0.9.0 neo3vm-stubs==0.9.0 -neofs-testlib==0.5.0 +neofs-testlib==0.6.0 netaddr==0.8.0 orjson==3.6.8 packaging==21.3 diff --git a/robot/resources/lib/python_keywords/neofs_verbs.py b/robot/resources/lib/python_keywords/neofs_verbs.py index 1a2472d..7ebe961 100644 --- a/robot/resources/lib/python_keywords/neofs_verbs.py +++ b/robot/resources/lib/python_keywords/neofs_verbs.py @@ -82,21 +82,23 @@ def get_range_hash( endpoint: Optional[str] = None, wallet_config: Optional[str] = None, xhdr: Optional[dict] = None, + session: Optional[str] = None, ): """ GETRANGEHASH of given Object. Args: - wallet (str): wallet on whose behalf GETRANGEHASH is done - cid (str): ID of Container where we get the Object from - oid (str): Object ID + wallet: wallet on whose behalf GETRANGEHASH is done + cid: ID of Container where we get the Object from + oid: Object ID shell: executor for cli command - 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,..., + bearer: path to Bearer Token file, appends to `--bearer` key + range_cut: 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 - wallet_config(optional, str): path to the wallet config - xhdr (optional, dict): Request X-Headers in form of Key=Value + endpoint: NeoFS endpoint to send request to, appends to `--rpc-endpoint` key + wallet_config: path to the wallet config + xhdr: Request X-Headers in form of Key=Values + session: Filepath to a JSON- or binary-encoded token of the object RANGEHASH session. Returns: None """ @@ -110,6 +112,7 @@ def get_range_hash( range=range_cut, bearer=bearer, xhdr=xhdr, + session=session, ) # cutting off output about range offset and length