aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2024-08-27 15:34:35 +0100
committerAlex Schofield <git@ajschof.me>2024-08-27 15:34:35 +0100
commitf5bccf178ea1ebce213efd0518af63d74b00a11c (patch)
tree53c9588eddc25f4010cc75356cba14753d1c87da /tests
parentf6584f5f52bc8731a2076e2d692faf28b107647d (diff)
downloadde-project-bentley-f5bccf178ea1ebce213efd0518af63d74b00a11c.tar.gz
de-project-bentley-f5bccf178ea1ebce213efd0518af63d74b00a11c.zip
test: add lambda_handler tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_load_lambda.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/test_load_lambda.py b/tests/test_load_lambda.py
index b5821a4..98ab36b 100644
--- a/tests/test_load_lambda.py
+++ b/tests/test_load_lambda.py
@@ -31,13 +31,28 @@ def mock_sm_client(aws_credentials):
yield boto3.client("secretsmanager")
-@pytest.fixture(scope="class")
-def mock_connect_db(mocker):
- return mocker.patch("src.load_lambda.connect_to_db_and_return_engine")
-
-
class TestLambdaHandler:
- pass
+ def test_lambda_handler_returns_success(self, mocker):
+ mocker.patch(
+ "src.load_lambda.upload_dfs_to_database",
+ return_value={"uploaded": ["table_one", "table_two"]},
+ )
+ result = lambda_handler(None, None)
+ assert result["statusCode"] == 200
+ assert "table_one" in result["body"]
+ assert "table_two" in result["body"]
+
+ def test_lambda_handler_does_not_upload_anything(self, mocker):
+ mocker.patch(
+ "src.load_lambda.upload_dfs_to_database",
+ return_value={"uploaded": []},
+ )
+ result = lambda_handler(None, None)
+ assert result["statusCode"] == 200
+ assert "No dataframes were uploaded" in result["body"]
+
+ def test_lambda_handler_returns_exception(self, mocker):
+ pass
class TestRetrieveSecrets:
git.ajschof.me — hosted by ajschofield — powered by cgit