mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 20:42:02 +00:00
chore(aws): cleanup tests in dynamodb and cw (#5588)
This commit is contained in:
+13
-5
@@ -1,4 +1,4 @@
|
||||
from re import search
|
||||
from datetime import datetime
|
||||
from unittest import mock
|
||||
|
||||
from boto3 import client
|
||||
@@ -11,6 +11,13 @@ from tests.providers.aws.utils import (
|
||||
set_mocked_aws_provider,
|
||||
)
|
||||
|
||||
timestamp = int(unix_time_millis())
|
||||
dttimestamp = (
|
||||
(datetime.fromtimestamp(timestamp / 1000))
|
||||
.astimezone()
|
||||
.isoformat(timespec="milliseconds")
|
||||
)
|
||||
|
||||
|
||||
class Test_cloudwatch_log_group_no_secrets_in_logs:
|
||||
def test_cloudwatch_no_log_groups(self):
|
||||
@@ -59,7 +66,7 @@ class Test_cloudwatch_log_group_no_secrets_in_logs:
|
||||
logStreamName="test stream",
|
||||
logEvents=[
|
||||
{
|
||||
"timestamp": int(unix_time_millis()),
|
||||
"timestamp": timestamp,
|
||||
"message": "non sensitive message",
|
||||
}
|
||||
],
|
||||
@@ -118,7 +125,7 @@ class Test_cloudwatch_log_group_no_secrets_in_logs:
|
||||
logStreamName="test stream",
|
||||
logEvents=[
|
||||
{
|
||||
"timestamp": int(unix_time_millis()),
|
||||
"timestamp": timestamp,
|
||||
"message": "password = password123",
|
||||
}
|
||||
],
|
||||
@@ -156,8 +163,9 @@ class Test_cloudwatch_log_group_no_secrets_in_logs:
|
||||
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
"Potential secrets found in log group", result[0].status_extended
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== f"Potential secrets found in log group test in log stream test stream at {dttimestamp} - Secret Keyword on line 1."
|
||||
)
|
||||
assert result[0].resource_id == "test"
|
||||
assert (
|
||||
|
||||
+6
-6
@@ -1,4 +1,3 @@
|
||||
from re import search
|
||||
from unittest import mock
|
||||
|
||||
from boto3 import client
|
||||
@@ -75,9 +74,9 @@ class Test_dynamodb_tables_pitr_enabled:
|
||||
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
"does not have point-in-time recovery enabled",
|
||||
result[0].status_extended,
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "DynamoDB table test1 does not have point-in-time recovery enabled."
|
||||
)
|
||||
assert result[0].resource_id == table["TableName"]
|
||||
assert result[0].resource_arn == table["TableArn"]
|
||||
@@ -126,8 +125,9 @@ class Test_dynamodb_tables_pitr_enabled:
|
||||
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "PASS"
|
||||
assert search(
|
||||
"has point-in-time recovery enabled", result[0].status_extended
|
||||
assert (
|
||||
result[0].status_extended
|
||||
== "DynamoDB table test1 has point-in-time recovery enabled."
|
||||
)
|
||||
assert result[0].resource_id == table["TableName"]
|
||||
assert result[0].resource_arn == table["TableArn"]
|
||||
|
||||
Reference in New Issue
Block a user