From 0c95b93303dea04e18aefe57e3b6fef7e4127c3c Mon Sep 17 00:00:00 2001 From: Ellie Date: Fri, 23 Aug 2024 13:22:23 +0100 Subject: add working completed tests for get transform bucket --- tests/test_load_lambda.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/test_load_lambda.py b/tests/test_load_lambda.py index 7f001df..f1c2b01 100644 --- a/tests/test_load_lambda.py +++ b/tests/test_load_lambda.py @@ -29,11 +29,19 @@ class TestConnectToDBAndReturnEngine: pass class TestGetTransformBucket: - def test_get_transform_bucket_raises_error_if_no_buckets(self, mock_s3_client): + def test_raises_value_error_if_no_buckets(self, mock_s3_client): with pytest.raises(ValueError, match="No transform bucket found"): get_transform_bucket(mock_s3_client) - def test_get_transform_bucket_returns_transform_bucket_if_one_bucket(self, mock_s3_client): + 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"}, + ) + 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"}, @@ -41,16 +49,16 @@ class TestGetTransformBucket: result = get_transform_bucket(mock_s3_client) assert result == "transform_bucket" - def test_get_transform_bucket_only_returns_transform_bucket_if_several_buckets(self, mock_s3_client): + def test_only_returns_transform_bucket_if_several_buckets(self, mock_s3_client): mock_s3_client.create_bucket( - Bucket="extract_bucket", + Bucket="another_test_bucket", CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}, ) result = get_transform_bucket(mock_s3_client) assert result == "transform_bucket" class TestConvertParquetToDfs: - pass + pass class TestUploadDfsToDatabase: pass \ No newline at end of file -- cgit v1.2.3