aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorT-Aji <tolujbd2@gmail.com>2024-08-19 09:27:20 +0100
committerT-Aji <tolujbd2@gmail.com>2024-08-19 09:27:20 +0100
commitafc889de865e6ce42b19ce89c57e9bfed98d6757 (patch)
tree8bbfd76c5c95935fe64a8827ee3ded3284d30ac8 /tests
parent0727dab70cb56521b73c04ab8e378b7f165fc224 (diff)
downloadde-project-bentley-afc889de865e6ce42b19ce89c57e9bfed98d6757.tar.gz
de-project-bentley-afc889de865e6ce42b19ce89c57e9bfed98d6757.zip
test: handler exception test failing
Diffstat (limited to 'tests')
-rw-r--r--tests/test_extract_lambda.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_extract_lambda.py b/tests/test_extract_lambda.py
index 4b61b83..bc40df1 100644
--- a/tests/test_extract_lambda.py
+++ b/tests/test_extract_lambda.py
@@ -76,6 +76,17 @@ class TestLambdaHandler:
mock_process_and_upload_tables.assert_called_once_with(mock_db, {})
mock_db.close.assert_called_once()
+ def test_lambda_handler_exception_error(self, mocker):
+ with patch("src.extract_lambda.connect_to_database", side_effect=Exception("Database connection error")):
+ mock_process_and_upload_tables = mocker.patch("src.extract_lambda.process_and_upload_tables")
+ mock_list_existing_s3_files = mocker.patch("src.extract_lambda.list_existing_s3_files")
+ event = {}
+ context = {}
+ response = lambda_handler(event, context)
+ assert response['statusCode'] == 500
+ assert json.loads(response['body']) == 'Internal server error.'
+ mock_list_existing_s3_files.assert_not_called()
+ mock_process_and_upload_tables.assert_not_called()
class TestListExistingS3Files:
def test_error_if_no_bucket(self, s3_client, caplog):
git.ajschof.me — hosted by ajschofield — powered by cgit