Update fixtures to be properly reflected in the allure report

This commit is contained in:
Andrey Berezin 2023-08-29 16:43:16 +03:00
parent ee110e5baf
commit 841d6674f6
2 changed files with 13 additions and 9 deletions

View file

@ -187,15 +187,19 @@ def s3_client(
yield client
@pytest.fixture
def versioning_status(request: pytest.FixtureRequest) -> VersioningStatus:
if "param" in request.__dict__:
return request.param
return VersioningStatus.UNDEFINED
@allure.step("Create/delete bucket")
@pytest.fixture
def bucket(s3_client: S3ClientWrapper, request: pytest.FixtureRequest):
def bucket(s3_client: S3ClientWrapper, versioning_status: VersioningStatus):
bucket_name = s3_client.create_bucket()
versioning_status: Optional[VersioningStatus] = None
if "param" in request.__dict__:
versioning_status = request.param
if versioning_status:
s3_helper.set_bucket_versioning(s3_client, bucket_name, versioning_status)

View file

@ -24,7 +24,7 @@ class TestS3GateMultipart(ClusterTestBase):
)
@allure.title("{s3_client}: Object Multipart API")
@pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True)
@pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True)
def test_s3_object_multipart(self, s3_client: S3ClientWrapper, bucket: str):
parts_count = 5
file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part
@ -58,8 +58,8 @@ class TestS3GateMultipart(ClusterTestBase):
got_object = s3_client.get_object(bucket, object_key)
assert get_file_hash(got_object) == get_file_hash(file_name_large)
@allure.title("{s3_client}: Multipart abort with")
@pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True)
@allure.title("{s3_client}: Abort Multipart Upload")
@pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True)
def test_s3_abort_multipart(
self,
s3_client: S3ClientWrapper,
@ -114,7 +114,7 @@ class TestS3GateMultipart(ClusterTestBase):
assert len(objects) == 0, f"Expected no objects in container, got\n{objects}"
@allure.title("{s3_client}: Upload Part Copy")
@pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True)
@pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True)
def test_s3_multipart_copy(self, s3_client: S3ClientWrapper, bucket: str):
parts_count = 3
file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part