From 566b99f7b83efb11df9f4b22be9f5c107139cd7b Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Fri, 8 Dec 2023 11:35:28 +0900 Subject: [PATCH] fix bug in test --- share/secretsmanager.py | 4 +--- tests/handlers/aws/test_handler.py | 2 +- tests/handlers/aws/test_utils.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/share/secretsmanager.py b/share/secretsmanager.py index 0f3079c7..b8fcedf2 100644 --- a/share/secretsmanager.py +++ b/share/secretsmanager.py @@ -27,7 +27,7 @@ def aws_sm_expander(config_yaml: str) -> str: Secrets Manager expander for config file It scans the file for the secrets manager arn pattern, checks for correct configuration, retrieves the values from the secret manager and replaces them in the config file. - Exceptions will be risen for the following scenarios: + Exceptions will be raised for the following scenarios: - Not respecting the arn pattern - Input is for both plain text and json keys for the same secret manager name - The fetched value is empty @@ -153,8 +153,6 @@ def parse_secrets_str(secrets: str, secret_arn: str) -> Union[str, dict[str, Any except JSONDecodeError: shared_logger.debug("parsed secrets as plaintext") return secrets - except Exception as e: - raise Exception(f"{e} while parsing {secret_arn}") else: shared_logger.debug("parsed secrets as json") return parsed_secrets diff --git a/tests/handlers/aws/test_handler.py b/tests/handlers/aws/test_handler.py index 95cb1248..6858d0bd 100644 --- a/tests/handlers/aws/test_handler.py +++ b/tests/handlers/aws/test_handler.py @@ -959,7 +959,7 @@ def test_lambda_handler_failure(self) -> None: handler(event, ctx) # type:ignore - with self.subTest("invalid secretsmanager: json TypeError risen"): + with self.subTest("invalid secretsmanager: json TypeError raised"): os.environ["S3_CONFIG_FILE"] = "s3://s3_config_file_bucket/s3_config_file_object_key" with self.assertRaisesRegex( ConfigFileException, diff --git a/tests/handlers/aws/test_utils.py b/tests/handlers/aws/test_utils.py index 9faef0a8..16e02ea5 100644 --- a/tests/handlers/aws/test_utils.py +++ b/tests/handlers/aws/test_utils.py @@ -108,7 +108,7 @@ def test_get_trigger_type_and_config_source(self) -> None: with self.subTest("body in first record: eventSource not override"): event = { "Records": [ - {"body": '{"Records": [{"eventSource":"not-available-trigger"}]', "eventSource": "aws:kinesis"} + {"body": '{"Records": [{"eventSource":"not-available-trigger"}]}', "eventSource": "aws:kinesis"} ] }