Skip to content

Commit

Permalink
s3_gate: Change object_lock_enabled_for_bucket to keyword arguments
Browse files Browse the repository at this point in the history
The object_lock_enabled_for_bucket argument in the create_bucket_s3 call
has been changed to keyword arguments

Signed-off-by: Oleg Kulachenko <[email protected]>
  • Loading branch information
vvarg229 committed Jan 9, 2024
1 parent 63bc21e commit ccd1022
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_s3_bucket_ACL(self):
with allure.step("Create bucket with ACL = public-read-write"):
acl = "public-read-write"
bucket = s3_gate_bucket.create_bucket_s3(
self.s3_client, True, acl=acl, bucket_configuration="rep-1"
self.s3_client, object_lock_enabled_for_bucket=True, acl=acl, bucket_configuration="rep-1"
)
bucket_acl = s3_gate_bucket.get_bucket_acl(self.s3_client, bucket)
assert_bucket_s3_acl(acl_grants=bucket_acl, permitted_users="AllUsers", acl=acl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def test_s3_create_bucket_with_ACL(self):

with allure.step("Create bucket with ACL private"):
acl="private"
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, True, acl=acl, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, acl=acl, bucket_configuration="rep-1")
bucket_acl = s3_gate_bucket.get_bucket_acl(self.s3_client, bucket)
assert_bucket_s3_acl(
acl_grants=bucket_acl, permitted_users="CanonicalUser", acl=acl
)

with allure.step("Create bucket with ACL = public-read"):
acl="public-read"
bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, True, acl=acl, bucket_configuration="rep-1")
bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, acl=acl, bucket_configuration="rep-1")
bucket_acl_1 = s3_gate_bucket.get_bucket_acl(self.s3_client, bucket_1)
assert_bucket_s3_acl(
acl_grants=bucket_acl_1, permitted_users="AllUsers", acl=acl
Expand All @@ -45,7 +45,7 @@ def test_s3_create_bucket_with_ACL(self):
with allure.step("Create bucket with ACL public-read-write"):
acl="public-read-write"
bucket_2 = s3_gate_bucket.create_bucket_s3(
self.s3_client, True, acl=acl, bucket_configuration="rep-1"
self.s3_client, object_lock_enabled_for_bucket=True, acl=acl, bucket_configuration="rep-1"
)
bucket_acl_2 = s3_gate_bucket.get_bucket_acl(self.s3_client, bucket_2)
assert_bucket_s3_acl(
Expand All @@ -55,7 +55,7 @@ def test_s3_create_bucket_with_ACL(self):
with allure.step("Create bucket with ACL = authenticated-read"):
acl="authenticated-read"
bucket_3 = s3_gate_bucket.create_bucket_s3(
self.s3_client, True, acl=acl, bucket_configuration="rep-1"
self.s3_client, object_lock_enabled_for_bucket=True, acl=acl, bucket_configuration="rep-1"
)
bucket_acl_3 = s3_gate_bucket.get_bucket_acl(self.s3_client, bucket_3)
assert_bucket_s3_acl(
Expand All @@ -69,7 +69,7 @@ def test_s3_create_bucket_with_grands(self):
with allure.step("Create bucket with --grant-read"):
bucket = s3_gate_bucket.create_bucket_s3(
self.s3_client,
True,
object_lock_enabled_for_bucket=True,
grant_read="uri=http://acs.amazonaws.com/groups/global/AllUsers",
bucket_configuration="rep-1",
)
Expand All @@ -81,7 +81,7 @@ def test_s3_create_bucket_with_grands(self):
with allure.step("Create bucket with --grant-wtite"):
bucket_1 = s3_gate_bucket.create_bucket_s3(
self.s3_client,
True,
object_lock_enabled_for_bucket=True,
grant_write="uri=http://acs.amazonaws.com/groups/global/AllUsers",
bucket_configuration="rep-1",
)
Expand All @@ -93,7 +93,7 @@ def test_s3_create_bucket_with_grands(self):
with allure.step("Create bucket with --grant-full-control"):
bucket_2 = s3_gate_bucket.create_bucket_s3(
self.s3_client,
True,
object_lock_enabled_for_bucket=True,
grant_full_control="uri=http://acs.amazonaws.com/groups/global/AllUsers",
bucket_configuration="rep-1",
)
Expand All @@ -108,7 +108,7 @@ def test_s3_bucket_object_lock(self, simple_object_size):
file_name = object_key_from_file_path(file_path)

with allure.step("Create bucket with --no-object-lock-enabled-for-bucket"):
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, False, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=False, bucket_configuration="rep-1")
date_obj = datetime.utcnow() + timedelta(days=1)
with pytest.raises(
Exception, match=r".*Object Lock configuration does not exist for this bucket.*"
Expand All @@ -123,7 +123,7 @@ def test_s3_bucket_object_lock(self, simple_object_size):
ObjectLockRetainUntilDate=date_obj.strftime("%Y-%m-%dT%H:%M:%S"),
)
with allure.step("Create bucket with --object-lock-enabled-for-bucket"):
bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")
date_obj_1 = datetime.utcnow() + timedelta(days=1)
s3_gate_object.put_object_s3(
self.s3_client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_s3_buckets(self, simple_object_size):
file_name = self.object_key_from_file_path(file_path)

with allure.step("Create buckets"):
bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket_1 = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")
set_bucket_versioning(self.s3_client, bucket_1, s3_gate_bucket.VersioningStatus.ENABLED)
bucket_2 = s3_gate_bucket.create_bucket_s3(self.s3_client, bucket_configuration="rep-1")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_s3_object_locking(self, version_id, simple_object_size):
file_name = object_key_from_file_path(file_path)
retention_period = 2

bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")

with allure.step("Put several versions of object into bucket"):
s3_gate_object.put_object_s3(self.s3_client, bucket, file_path)
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_s3_mode_compliance(self, version_id, simple_object_size):
retention_period = 2
retention_period_1 = 1

bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")

with allure.step("Put object into bucket"):
obj_version = s3_gate_object.put_object_s3(self.s3_client, bucket, file_path)
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_s3_mode_governance(self, version_id, simple_object_size):
retention_period_1 = 2
retention_period_2 = 5

bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")

with allure.step("Put object into bucket"):
obj_version = s3_gate_object.put_object_s3(self.s3_client, bucket, file_path)
Expand Down Expand Up @@ -186,7 +186,7 @@ def test_s3_legal_hold(self, version_id, simple_object_size):
file_path = generate_file(simple_object_size)
file_name = object_key_from_file_path(file_path)

bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, False, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=False, bucket_configuration="rep-1")

with allure.step("Put object into bucket"):
obj_version = s3_gate_object.put_object_s3(self.s3_client, bucket, file_path)
Expand All @@ -209,7 +209,7 @@ def test_s3_bucket_lock(self, simple_object_size):
file_name = object_key_from_file_path(file_path)
configuration = {"Rule": {"DefaultRetention": {"Mode": "COMPLIANCE", "Days": 1}}}

bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")

with allure.step("PutObjectLockConfiguration with ObjectLockEnabled=False"):
s3_gate_bucket.put_object_lock_configuration(self.s3_client, bucket, configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def object_key_from_file_path(full_path: str) -> str:
@allure.title("Test S3: try to disable versioning")
def test_s3_version_off(self):

bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, True, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=True, bucket_configuration="rep-1")
with pytest.raises(Exception):
set_bucket_versioning(self.s3_client, bucket, s3_gate_bucket.VersioningStatus.SUSPENDED)

Expand All @@ -33,7 +33,7 @@ def test_s3_version(self, simple_object_size):
file_path = generate_file(simple_object_size)
file_name = self.object_key_from_file_path(file_path)
bucket_objects = [file_name]
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, False, bucket_configuration="rep-1")
bucket = s3_gate_bucket.create_bucket_s3(self.s3_client, object_lock_enabled_for_bucket=False, bucket_configuration="rep-1")
set_bucket_versioning(self.s3_client, bucket, s3_gate_bucket.VersioningStatus.SUSPENDED)

with allure.step("Put object into bucket"):
Expand Down

0 comments on commit ccd1022

Please sign in to comment.