ruff format
This commit is contained in:
@@ -138,4 +138,4 @@ def raw_minio_client(minio_container: dict[str, str]) -> Generator[Minio]:
|
||||
# Cleanup
|
||||
objects = client.list_objects(bucket_name, recursive=True)
|
||||
for obj in objects:
|
||||
client.remove_object(bucket_name, obj.object_name)
|
||||
client.remove_object(bucket_name, obj.object_name)
|
||||
|
||||
@@ -31,14 +31,14 @@ def same_data(
|
||||
# compare size
|
||||
if len(data_a_bytes) != len(data_b_bytes):
|
||||
logging.error(
|
||||
'data has different length: %s and %s',
|
||||
"data has different length: %s and %s",
|
||||
len(data_a_bytes),
|
||||
len(data_b_bytes),
|
||||
)
|
||||
return False
|
||||
# compare content
|
||||
if data_a_bytes != data_b_bytes:
|
||||
logging.error('data has different bytes')
|
||||
logging.error("data has different bytes")
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -235,7 +235,16 @@ def test_should_log_warning_when_getting_nonexistent_object(
|
||||
# Arrange
|
||||
adapter = MinioAdapter()
|
||||
adapter._client = MagicMock(spec=Minio)
|
||||
adapter._client.get_object.side_effect = S3Error(code="NoSuchKey", message="", resource="", request_id="", host_id="", response="", bucket_name="test-bucket", object_name="missing-object")
|
||||
adapter._client.get_object.side_effect = S3Error(
|
||||
code="NoSuchKey",
|
||||
message="",
|
||||
resource="",
|
||||
request_id="",
|
||||
host_id="",
|
||||
response="",
|
||||
bucket_name="test-bucket",
|
||||
object_name="missing-object",
|
||||
)
|
||||
adapter._bucket_name = "test-bucket"
|
||||
object_name = "missing-object"
|
||||
# Act
|
||||
@@ -243,7 +252,10 @@ def test_should_log_warning_when_getting_nonexistent_object(
|
||||
result = adapter._get(object_name)
|
||||
# Assert
|
||||
assert result is None
|
||||
assert f"Object '{object_name}' not found in bucket '{adapter._bucket_name}'" in caplog.text
|
||||
assert (
|
||||
f"Object '{object_name}' not found in bucket '{adapter._bucket_name}'"
|
||||
in caplog.text
|
||||
)
|
||||
|
||||
|
||||
def test_should_log_error_when_getting_with_s3error_other_than_no_such_key(
|
||||
@@ -253,7 +265,16 @@ def test_should_log_error_when_getting_with_s3error_other_than_no_such_key(
|
||||
# Arrange
|
||||
adapter = MinioAdapter()
|
||||
adapter._client = MagicMock(spec=Minio)
|
||||
other_s3error = S3Error(code="UnhandledError", message="", resource="", request_id="", host_id="", response="", bucket_name="test-bucket", object_name="missing-object")
|
||||
other_s3error = S3Error(
|
||||
code="UnhandledError",
|
||||
message="",
|
||||
resource="",
|
||||
request_id="",
|
||||
host_id="",
|
||||
response="",
|
||||
bucket_name="test-bucket",
|
||||
object_name="missing-object",
|
||||
)
|
||||
adapter._client.get_object.side_effect = other_s3error
|
||||
adapter._bucket_name = "test-bucket"
|
||||
object_name = "missing-object"
|
||||
|
||||
Reference in New Issue
Block a user