mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 01:56:03 -04:00
fix tests
This commit is contained in:
@@ -13,7 +13,11 @@ content_type = "binary/octet-stream"
|
|||||||
|
|
||||||
|
|
||||||
def test_s3upload_save_file_to_bucket(mocker):
|
def test_s3upload_save_file_to_bucket(mocker):
|
||||||
mocked = mocker.patch("notifications_utils.s3.Session.resource")
|
|
||||||
|
mock_s3_client = mocker.Mock()
|
||||||
|
mocked = mocker.patch(
|
||||||
|
"notification_utils.s3.get_s3_client", return_value=mock_s3_client
|
||||||
|
)
|
||||||
s3upload(
|
s3upload(
|
||||||
filedata=contents, region=region, bucket_name=bucket, file_location=location
|
filedata=contents, region=region, bucket_name=bucket, file_location=location
|
||||||
)
|
)
|
||||||
@@ -27,7 +31,9 @@ def test_s3upload_save_file_to_bucket(mocker):
|
|||||||
|
|
||||||
def test_s3upload_save_file_to_bucket_with_contenttype(mocker):
|
def test_s3upload_save_file_to_bucket_with_contenttype(mocker):
|
||||||
content_type = "image/png"
|
content_type = "image/png"
|
||||||
mocked = mocker.patch("notifications_utils.s3.Session.resource")
|
|
||||||
|
mock_s3_client = mocker.Mock()
|
||||||
|
mocked = mocker.patch("app.aws.s3.get_s3_client", return_value=mock_s3_client)
|
||||||
s3upload(
|
s3upload(
|
||||||
filedata=contents,
|
filedata=contents,
|
||||||
region=region,
|
region=region,
|
||||||
@@ -44,7 +50,9 @@ def test_s3upload_save_file_to_bucket_with_contenttype(mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_s3upload_raises_exception(app, mocker):
|
def test_s3upload_raises_exception(app, mocker):
|
||||||
mocked = mocker.patch("notifications_utils.s3.Session.resource")
|
|
||||||
|
mock_s3_client = mocker.Mock()
|
||||||
|
mocked = mocker.patch("app.aws.s3.get_s3_client", return_value=mock_s3_client)
|
||||||
response = {"Error": {"Code": 500}}
|
response = {"Error": {"Code": 500}}
|
||||||
exception = botocore.exceptions.ClientError(response, "Bad exception")
|
exception = botocore.exceptions.ClientError(response, "Bad exception")
|
||||||
mocked.return_value.Object.return_value.put.side_effect = exception
|
mocked.return_value.Object.return_value.put.side_effect = exception
|
||||||
|
|||||||
Reference in New Issue
Block a user