Skip to content

Commit

Permalink
S3 upload tests should not depend on identity of bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
dragon-dxw committed Sep 4, 2023
1 parent f72f7a4 commit 9192e25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ds-caselaw-ingester/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,23 @@ def test_store_file_success(self, mock_print):
session.upload_fileobj = MagicMock()
lambda_function.store_file(None, "folder", "filename.ext", session)
mock_print.assert_called_with("Upload Successful folder/filename.ext")
session.upload_fileobj.assert_called_with(None, None, "folder/filename.ext")
session.upload_fileobj.assert_called_with(None, ANY, "folder/filename.ext")

@patch("builtins.print")
def test_store_file_file_not_found(self, mock_print):
session = boto3.Session
session.upload_fileobj = MagicMock(side_effect=FileNotFoundError)
lambda_function.store_file(None, "folder", "filename.ext", session)
mock_print.assert_called_with("The file folder/filename.ext was not found")
session.upload_fileobj.assert_called_with(None, None, "folder/filename.ext")
session.upload_fileobj.assert_called_with(None, ANY, "folder/filename.ext")

@patch("builtins.print")
def test_store_file_file_no_credentials(self, mock_print):
session = boto3.Session
session.upload_fileobj = MagicMock(side_effect=NoCredentialsError)
lambda_function.store_file(None, "folder", "filename.ext", session)
mock_print.assert_called_with("Credentials not available")
session.upload_fileobj.assert_called_with(None, None, "folder/filename.ext")
session.upload_fileobj.assert_called_with(None, ANY, "folder/filename.ext")

@patch.dict(
os.environ,
Expand Down

0 comments on commit 9192e25

Please sign in to comment.