[#348] Fixed check of fields in S3 aws/boto3 methods related to policies

Signed-off-by: y.lukoyanova <y.lukoyanova@yadro.com>
This commit is contained in:
Yaroslava Lukoyanova 2025-01-15 16:31:54 +03:00
parent daf186690b
commit 80dd8d0b16
2 changed files with 12 additions and 12 deletions

View file

@ -1227,7 +1227,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
return response
@ -1239,7 +1239,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
return response
@ -1264,7 +1264,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
return response
@ -1276,7 +1276,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
return response
@ -1288,7 +1288,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
return response
@ -1324,7 +1324,7 @@ class AwsCliClient(S3ClientWrapper):
output = self.local_shell.exec(cmd).stdout
response = self._to_json(output)
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
return response

View file

@ -1091,7 +1091,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
return response
@reporter.step("Lists all managed policies that are attached to the specified IAM user")
@ -1102,7 +1102,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert response.get("AttachedPolicies"), f"Expected AttachedPolicies in response:\n{response}"
assert "AttachedPolicies" in response.keys(), f"Expected AttachedPolicies in response:\n{response}"
return response
@reporter.step("Lists all IAM users, groups, and roles that the specified managed policy is attached to")
@ -1127,7 +1127,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
return response
@reporter.step("Lists the IAM groups")
@ -1137,7 +1137,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
return response
@reporter.step("Lists the IAM groups that the specified IAM user belongs to")
@ -1148,7 +1148,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert response.get("Groups"), f"Expected Groups in response:\n{response}"
assert "Groups" in response.keys(), f"Expected Groups in response:\n{response}"
return response
@reporter.step("Lists all the managed policies that are available in your AWS account")
@ -1180,7 +1180,7 @@ class Boto3ClientWrapper(S3ClientWrapper):
endpoint=self.iam_endpoint,
profile=self.profile,
)
assert response.get("PolicyNames"), f"Expected PolicyNames in response:\n{response}"
assert "PolicyNames" in response.keys(), f"Expected PolicyNames in response:\n{response}"
return response
@reporter.step("Lists the IAM users")