moto/tests/test_core/test_context_manager.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
445 B
Python
Raw Normal View History

2019-07-10 01:31:43 +00:00
import boto3
from moto import mock_sqs, settings
2022-08-13 09:49:43 +00:00
from tests import DEFAULT_ACCOUNT_ID
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:
conn = boto3.client("sqs", region_name="us-west-1")
conn.create_queue(QueueName="queue1")
if not settings.TEST_SERVER_MODE:
2022-08-13 09:49:43 +00:00
backend = sqs_mock.backends[DEFAULT_ACCOUNT_ID]["us-west-1"]
assert list(backend.queues.keys()) == ["queue1"]