From 2ac0fac46d5d0dd641c303670d3152d55029800a Mon Sep 17 00:00:00 2001 From: Eric Hanson Date: Wed, 20 Oct 2021 16:12:34 -0400 Subject: [PATCH] Update based on further discussion in #14 --- tests/test_sqs.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_sqs.py b/tests/test_sqs.py index 4d99d14..33f0f11 100644 --- a/tests/test_sqs.py +++ b/tests/test_sqs.py @@ -1,11 +1,15 @@ import boto3 +import pytest +from botocore.exceptions import ClientError from moto import mock_sqs from awd import sqs @mock_sqs -def test_sqs_send(sqs_client, dss_message_attributes_example, dss_message_body_example): +def test_sqs_send_success( + sqs_client, dss_message_attributes_example, dss_message_body_example +): sqs = boto3.resource("sqs", region_name="us-east-1") sqs_queue = sqs.create_queue(QueueName="mock-queue") response = sqs_client.send( @@ -14,6 +18,17 @@ def test_sqs_send(sqs_client, dss_message_attributes_example, dss_message_body_e assert response["ResponseMetadata"]["HTTPStatusCode"] == 200 +@mock_sqs +def test_sqs_send_failure( + sqs_client, dss_message_attributes_example, dss_message_body_example +): + with pytest.raises(ClientError): + response = sqs_client.send( + "non-existent", dss_message_attributes_example, dss_message_body_example + ) + assert response["ResponseMetadata"]["HTTPStatusCode"] == 200 + + def test_create_dss_message_attributes(dss_message_attributes_example): dss_message_attributes = sqs.create_dss_message_attributes( "123", "Submission system", "DSS queue"