Skip to content

Commit

Permalink
ruff: apply new linter rules
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed May 3, 2024
1 parent b4055be commit 75b9906
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pytest_tests/lib/helpers/cli_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _cmd_run(cmd: str, timeout: int = 30) -> str:
logger.info(
f"Command: {cmd}\n"
f"Error:\nreturn code: {return_code}\n"
f"Output: {exc.output.decode('utf-8') if type(exc.output) is bytes else exc.output}"
f"Output: {exc.output.decode('utf-8') if isinstance(exc.output, bytes) else exc.output}"
)
raise

Expand Down
1 change: 0 additions & 1 deletion pytest_tests/lib/helpers/s3_helper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import datetime
import logging
import os
from datetime import datetime, timedelta
Expand Down
1 change: 0 additions & 1 deletion pytest_tests/tests/services/s3_gate/test_s3_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ def test_s3_api_object_tagging(self, bucket, simple_object_size):
"""
Test checks S3 Object tagging API (Put tag/Get tag/Update tag).
"""
key_value_pair_bucket = [("some-key", "some-value"), ("some-key-2", "some-value-2")]
key_value_pair_obj = [
("some-key-obj", "some-value-obj"),
("some-key--obj2", "some-value--obj2"),
Expand Down
12 changes: 5 additions & 7 deletions pytest_tests/tests/services/s3_gate/test_s3_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_s3_copy_acl(self, bucket, simple_object_size):
set_bucket_versioning(self.s3_client, bucket, s3_gate_bucket.VersioningStatus.ENABLED)

with allure.step("Put several versions of object into bucket"):
version_id_1 = s3_gate_object.put_object_s3(self.s3_client, bucket, file_name_simple)
s3_gate_object.put_object_s3(self.s3_client, bucket, file_name_simple)
check_objects_in_bucket(self.s3_client, bucket, [obj_key])

with allure.step("Copy object and check acl attribute"):
Expand Down Expand Up @@ -185,9 +185,7 @@ def test_s3_copy_tagging(self, bucket, simple_object_size):

with allure.step("Put several versions of object into bucket"):
s3_gate_object.put_object_s3(self.s3_client, bucket, file_path)
version_id_1 = s3_gate_object.put_object_tagging(
self.s3_client, bucket, file_name_simple, tags=object_tagging
)
s3_gate_object.put_object_tagging(self.s3_client, bucket, file_name_simple, tags=object_tagging)
bucket_1_objects = [file_name_simple]
check_objects_in_bucket(self.s3_client, bucket, bucket_1_objects)

Expand Down Expand Up @@ -267,7 +265,7 @@ def test_s3_delete_versioning(self, bucket, complex_object_size, simple_object_s
with allure.step("Put new object into bucket"):
file_name_simple = generate_file(complex_object_size)
obj_key = os.path.basename(file_name_simple)
version_id = s3_gate_object.put_object_s3(self.s3_client, bucket, file_name_simple)
s3_gate_object.put_object_s3(self.s3_client, bucket, file_name_simple)

with allure.step("Delete last object"):
delete_obj = s3_gate_object.delete_object_s3(self.s3_client, bucket, obj_key)
Expand Down Expand Up @@ -683,7 +681,7 @@ def test_s3_put_object_lock_mode(self, complex_object_size, simple_object_size):
"Put new version of object with [--object-lock-mode COMPLIANCE] и [--object-lock-retain-until-date +3days]"
):
date_obj = datetime.utcnow() + timedelta(days=2)
file_name_1 = generate_file_with_content(simple_object_size, file_path=file_path_1)
generate_file_with_content(simple_object_size, file_path=file_path_1)
s3_gate_object.put_object_s3(
self.s3_client,
bucket,
Expand All @@ -697,7 +695,7 @@ def test_s3_put_object_lock_mode(self, complex_object_size, simple_object_size):
"Put new version of object with [--object-lock-mode COMPLIANCE] и [--object-lock-retain-until-date +2days]"
):
date_obj = datetime.utcnow() + timedelta(days=3)
file_name_1 = generate_file_with_content(simple_object_size, file_path=file_path_1)
generate_file_with_content(simple_object_size, file_path=file_path_1)
s3_gate_object.put_object_s3(
self.s3_client,
bucket,
Expand Down
4 changes: 2 additions & 2 deletions pytest_tests/tests/services/s3_gate/test_s3_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_s3_bucket_location(self, simple_object_size):
# with allure.step("Check head buckets"):
head_1 = s3_gate_bucket.head_bucket(self.s3_client, bucket_1)
head_2 = s3_gate_bucket.head_bucket(self.s3_client, bucket_2)
assert head_1 == {} or head_1.get("HEAD") == None, "Expected head is empty"
assert head_2 == {} or head_2.get("HEAD") == None, "Expected head is empty"
assert head_1 == {} or head_1.get("HEAD") is None, "Expected head is empty"
assert head_2 == {} or head_2.get("HEAD") is None, "Expected head is empty"

with allure.step("Put objects into buckets"):
version_id_1 = s3_gate_object.put_object_s3(self.s3_client, bucket_1, file_path_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_not_owner_user_can_not_delete_container(
endpoint=self.neofs_env.sn_rpc,
)

user_token = self.static_session_token(owner_wallet, user_wallet, self.shell, temp_directory)
self.static_session_token(owner_wallet, user_wallet, self.shell, temp_directory)
stranger_token = self.static_session_token(user_wallet, stranger_wallet, self.shell, temp_directory)

with allure.step("Try to delete container using stranger token"):
Expand Down

0 comments on commit 75b9906

Please sign in to comment.