Skip to content

Commit

Permalink
tests: fix ebs
Browse files Browse the repository at this point in the history
  • Loading branch information
jfagoagas committed Mar 5, 2024
1 parent 68924b3 commit 6f33e1c
Showing 1 changed file with 36 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ def test_ec2_ebs_encryption_enabled(self):
result.status_extended == "EBS Default Encryption is activated."
)
assert result.resource_id == AWS_ACCOUNT_NUMBER
assert (
result.resource_arn
== f"arn:aws:ec2:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:volume"
)
if result.region == AWS_REGION_EU_WEST_1:
assert result.status == "FAIL"
assert (
result.status_extended
== "EBS Default Encryption is not activated."
)
assert result.resource_id == AWS_ACCOUNT_NUMBER
assert (
result.resource_arn
== f"arn:aws:ec2:{AWS_REGION_EU_WEST_1}:{AWS_ACCOUNT_NUMBER}:volume"
Expand All @@ -76,28 +87,33 @@ def test_ec2_ebs_encryption_disabled(self):
)

check = ec2_ebs_default_encryption()
result = check.execute()
results = check.execute()

# One result per region
assert len(result) == 2
assert result[0].status == "FAIL"
assert (
result[0].status_extended == "EBS Default Encryption is not activated."
)
assert result[0].resource_id == AWS_ACCOUNT_NUMBER
assert (
result[0].resource_arn
== f"arn:aws:ec2:{AWS_REGION_EU_WEST_1}:{AWS_ACCOUNT_NUMBER}:volume"
)
assert result[1].status == "FAIL"
assert (
result[1].status_extended == "EBS Default Encryption is not activated."
)
assert result[1].resource_id == AWS_ACCOUNT_NUMBER
assert (
result[1].resource_arn
== f"arn:aws:ec2:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:volume"
)
assert len(results) == 2
for result in results:
if result.region == AWS_REGION_US_EAST_1:
assert result.status == "FAIL"
assert (
result.status_extended
== "EBS Default Encryption is not activated."
)
assert result.resource_id == AWS_ACCOUNT_NUMBER
assert (
result.resource_arn
== f"arn:aws:ec2:{AWS_REGION_US_EAST_1}:{AWS_ACCOUNT_NUMBER}:volume"
)
if result.region == AWS_REGION_EU_WEST_1:
assert result.status == "FAIL"
assert (
result.status_extended
== "EBS Default Encryption is not activated."
)
assert result.resource_id == AWS_ACCOUNT_NUMBER
assert (
result.resource_arn
== f"arn:aws:ec2:{AWS_REGION_EU_WEST_1}:{AWS_ACCOUNT_NUMBER}:volume"
)

@mock_aws
def test_ec2_ebs_encryption_disabled_ignored(self):
Expand Down

0 comments on commit 6f33e1c

Please sign in to comment.