Skip to content

Commit

Permalink
update moto dev requirement (#2686)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek authored Sep 6, 2024
1 parent 76b65f9 commit 162ac5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pytest
pytest-env
python3-saml>=1.9,<1.17
typing_extensions>=3.7.4
moto[sqs]<5.0
moto[sqs]==5.0.13
pyexiv2>=2.12.0,<2.13; sys_platform == 'linux'

-e .
Expand Down
16 changes: 11 additions & 5 deletions tests/publish/transmitters/amazon_sqs_fifo_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

from unittest import TestCase, mock
import json
import boto3
from moto import mock_sqs

import json
from moto import mock_aws
from unittest import TestCase, mock

from superdesk.publish.transmitters.amazon_sqs_fifo import AmazonSQSFIFOPublishService
from superdesk.errors import PublishAmazonSQSError


@mock_sqs
class AmazonSQSFIFOPublishServiceTestCase(TestCase):
def setUp(self):
self.config = {
Expand Down Expand Up @@ -48,6 +47,9 @@ def setUp(self):
},
}

self.mock_aws = mock_aws()
self.mock_aws.start()

self.sqs = boto3.resource(
"sqs",
aws_access_key_id=self.config["access_key_id"],
Expand All @@ -56,6 +58,10 @@ def setUp(self):
)
self.service = AmazonSQSFIFOPublishService()

def tearDown(self) -> None:
self.mock_aws.stop()
return super().tearDown()

def _create_queue(self):
self.sqs.create_queue(
QueueName=self.config["queue_name"],
Expand All @@ -79,7 +85,7 @@ def test_publish_an_item(self):

@mock.patch("superdesk.errors.notifications_enabled", return_value=False)
def test_connection_error(self, _notifications_enabled):
self.config["endpoint_url"] = "https://localhost.localdomain"
self.config["endpoint_url"] = "http://abcd"

with self.assertRaises(PublishAmazonSQSError) as context:
self.service._transmit(self.item, {})
Expand Down

0 comments on commit 162ac5d

Please sign in to comment.