aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_load_lambda.py
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2024-08-23 16:11:45 +0000
committerGitHub <noreply@github.com>2024-08-23 16:11:45 +0000
commit69edb14dad584d45fa6a83a90c08292b84795507 (patch)
tree099f687557ba2cc8c379014492e3c05421912edd /tests/test_load_lambda.py
parent0ff29566a1eb9551bb83bcc07705c932d22f8c08 (diff)
downloadde-project-bentley-69edb14dad584d45fa6a83a90c08292b84795507.tar.gz
de-project-bentley-69edb14dad584d45fa6a83a90c08292b84795507.zip
style: format code with Autopep8, Black and Ruff Formatter
This commit fixes the style issues introduced in 0ff2956 according to the output from Autopep8, Black and Ruff Formatter. Details: https://github.com/ajschofield/de-project-bentley/pull/95
Diffstat (limited to 'tests/test_load_lambda.py')
-rw-r--r--tests/test_load_lambda.py44
1 files changed, 29 insertions, 15 deletions
diff --git a/tests/test_load_lambda.py b/tests/test_load_lambda.py
index e04ccec..88c71e4 100644
--- a/tests/test_load_lambda.py
+++ b/tests/test_load_lambda.py
@@ -5,7 +5,14 @@ from moto import mock_aws
import boto3
import os
import pytest
-from src.load_lambda import lambda_handler, connect_to_db_and_return_engine, get_transform_bucket, convert_parquet_files_to_dfs, upload_dfs_to_database
+from src.load_lambda import (
+ lambda_handler,
+ connect_to_db_and_return_engine,
+ get_transform_bucket,
+ convert_parquet_files_to_dfs,
+ upload_dfs_to_database,
+)
+
@pytest.fixture(scope="class")
def aws_credentials():
@@ -25,12 +32,15 @@ def mock_s3_client(aws_credentials):
class TestLambdaHandler:
pass
+
class TestRetrieveSecrets:
pass
+
class TestConnectToDBAndReturnEngine:
pass
+
class TestGetTransformBucket:
def test_raises_value_error_if_no_buckets(self, mock_s3_client):
with pytest.raises(ValueError, match="No transform bucket found"):
@@ -38,35 +48,38 @@ class TestGetTransformBucket:
def test_raises_value_error_if_no_transform_bucket(self, mock_s3_client):
mock_s3_client.create_bucket(
- Bucket="extract_bucket",
- CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
- )
+ Bucket="extract_bucket",
+ CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
+ )
with pytest.raises(ValueError, match="No transform bucket found"):
get_transform_bucket(mock_s3_client)
def test_returns_transform_bucket_if_one_bucket(self, mock_s3_client):
mock_s3_client.create_bucket(
- Bucket="transform_bucket",
- CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
- )
+ Bucket="transform_bucket",
+ CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
+ )
result = get_transform_bucket(mock_s3_client)
assert result == "transform_bucket"
def test_only_returns_transform_bucket_if_several_buckets(self, mock_s3_client):
mock_s3_client.create_bucket(
- Bucket="another_test_bucket",
- CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
- )
+ Bucket="another_test_bucket",
+ CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
+ )
result = get_transform_bucket(mock_s3_client)
assert result == "transform_bucket"
+
class TestConvertParquetToDfs:
def test_function_returns_empty_dictionary_if_no_files(self, mock_s3_client):
mock_s3_client.create_bucket(
- Bucket="transform_bucket",
- CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
- )
- result = convert_parquet_files_to_dfs(bucket_name="transform_bucket", client=mock_s3_client)
+ Bucket="transform_bucket",
+ CreateBucketConfiguration={"LocationConstraint": "eu-west-2"},
+ )
+ result = convert_parquet_files_to_dfs(
+ bucket_name="transform_bucket", client=mock_s3_client
+ )
assert result == {}
# def test_function_returns_dictionary_with_table_with_file_key():
@@ -74,5 +87,6 @@ class TestConvertParquetToDfs:
# result = convert_parquet_files_to_dfs(bucket_name="transform_bucket", client=mock_s3_client)
# assert "dim_staff" in result
+
class TestUploadDfsToDatabase:
- pass \ No newline at end of file
+ pass
git.ajschof.me — hosted by ajschofield — powered by cgit