moto/tests/test_core/test_context_manager.py

13 lines
414 B
Python
Raw Normal View History

2021-10-18 19:44:29 +00:00
import sure # noqa # pylint: disable=unused-import
2019-07-10 01:31:43 +00:00
import boto3
from moto import mock_sqs, settings
2019-07-10 01:31:43 +00:00
2019-07-11 02:16:11 +00:00
def test_context_manager_returns_mock():
2019-07-10 01:31:43 +00:00
with mock_sqs() as sqs_mock:
2019-10-31 15:44:26 +00:00
conn = boto3.client("sqs", region_name="us-west-1")
2019-07-10 01:31:43 +00:00
conn.create_queue(QueueName="queue1")
if not settings.TEST_SERVER_MODE:
2019-10-31 15:44:26 +00:00
list(sqs_mock.backends["us-west-1"].queues.keys()).should.equal(["queue1"])