diff options
| author | Alex Schofield <git@ajschof.me> | 2024-08-27 15:34:35 +0100 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2024-08-27 15:34:35 +0100 |
| commit | f5bccf178ea1ebce213efd0518af63d74b00a11c (patch) | |
| tree | 53c9588eddc25f4010cc75356cba14753d1c87da /tests | |
| parent | f6584f5f52bc8731a2076e2d692faf28b107647d (diff) | |
| download | de-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.py | 27 |
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: |
