diff options
| author | Alex Schofield <git@ajschof.me> | 2024-08-22 12:27:55 +0100 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2024-08-22 12:27:55 +0100 |
| commit | dc7dfe29ce977f3038fb3affd617683e8f163dc8 (patch) | |
| tree | e872d4a3a5d603175a0a30d6f29f84d86a392e83 /tests/test_extract_lambda.py | |
| parent | 2238618164eb838c8b5e27c2cf3f5ed748637a3d (diff) | |
| download | de-project-bentley-dc7dfe29ce977f3038fb3affd617683e8f163dc8.tar.gz de-project-bentley-dc7dfe29ce977f3038fb3affd617683e8f163dc8.zip | |
fix: handle no buckets properly
Diffstat (limited to 'tests/test_extract_lambda.py')
| -rw-r--r-- | tests/test_extract_lambda.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_extract_lambda.py b/tests/test_extract_lambda.py index 1266cbb..bba433c 100644 --- a/tests/test_extract_lambda.py +++ b/tests/test_extract_lambda.py @@ -184,10 +184,8 @@ class TestExtractBucket: result = extract_bucket(s3_client) assert result == "extract_bucket" - def test_returns_index_error_if_no_buckets(self, s3_client): - # We don't even need to delete the bucket as there are no buckets - # due to the mock being reset for each test function now - with pytest.raises(IndexError, match="list index out of range"): + def test_raises_value_error_if_no_buckets(self, s3_client): + with pytest.raises(ValueError, match="No extract_bucket found"): extract_bucket(s3_client) @@ -196,7 +194,9 @@ class TestListExistingS3Files: logger = logging.getLogger() logger.info("Testing now.") caplog.set_level(logging.ERROR) - list_existing_s3_files(client=s3_client) + + with pytest.raises(ValueError, match="No extract_bucket found"): + list_existing_s3_files(client=s3_client) assert "Error listing S3 objects" in caplog.text def test_error_if_bucket_is_empty(self, s3_client, caplog, s3_mock_bucket): |
