aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
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