本文整理汇总了Python中moto.mock_sqs方法的典型用法代码示例。如果您正苦于以下问题:Python moto.mock_sqs方法的具体用法?Python moto.mock_sqs怎么用?Python moto.mock_sqs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moto
的用法示例。
在下文中一共展示了moto.mock_sqs方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: historical_sqs
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def historical_sqs():
"""Create the Mocked SQS queues that are used throughout Historical."""
with mock_sqs():
client = boto3.client('sqs', region_name='us-east-1')
# Poller Tasker Queue:
client.create_queue(QueueName='pollertaskerqueue')
os.environ['POLLER_TASKER_QUEUE_NAME'] = 'pollertaskerqueue'
# Poller Queue:
client.create_queue(QueueName='pollerqueue')
os.environ['POLLER_QUEUE_NAME'] = 'pollerqueue'
# Event Queue:
client.create_queue(QueueName='eventqueue')
os.environ['EVENT_QUEUE_NAME'] = 'eventqueue'
# Proxy Queue:
client.create_queue(QueueName='proxyqueue')
yield client
示例2: boto_patches
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def boto_patches(context):
mock_sqs_obj = mock_sqs()
mock_sqs_obj.start()
mock_ec2_obj = mock_ec2()
mock_ec2_obj.start()
mock_autoscaling_obj = mock_autoscaling()
mock_autoscaling_obj.start()
vpc_response = ec2.create_vpc(CidrBlock='10.0.0.0/24')
subnet_response = ec2.create_subnet(
CidrBlock='10.0.0.0/24',
VpcId=vpc_response['Vpc']['VpcId'],
AvailabilityZone='us-west-2a'
)
context.subnet_id = subnet_response['Subnet']['SubnetId']
yield
mock_sqs_obj.stop()
mock_ec2_obj.stop()
mock_autoscaling_obj.stop()
示例3: retry
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def retry(self):
with moto.mock_sqs():
retry = lambda_handler.Retry(logging)
yield retry
示例4: decorate
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def decorate(cls, func):
return moto.mock_sqs(moto.mock_sns(responses.activate(func)))
示例5: __init__
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def __init__(self):
self.mock_sqs = None
示例6: start_mocking
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def start_mocking(self):
"""Method to start mocking"""
self.mock = True
self.mock_sqs = mock_sqs()
self.mock_sqs.start()
示例7: stop_mocking
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def stop_mocking(self):
"""Method to stop mocking"""
self.mock_sqs.stop()
# ***** Upload Task SQS Queue *****
示例8: create_upload_queue
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def create_upload_queue(self, queue_name):
"""Method to create a test sqs for uploading tiles for the ingest"""
if self.mock:
url = mock_sqs(self._create_upload_queue(queue_name))
else:
url = self._create_upload_queue(queue_name)
time.sleep(30)
return url
示例9: delete_upload_queue
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def delete_upload_queue(self, queue_name):
"""Method to delete a test sqs for uploading tiles for the ingest"""
if self.mock:
mock_sqs(self._delete_upload_queue(queue_name))
else:
self._delete_upload_queue(queue_name)
# ***** END Flush SQS Queue *****
示例10: sqs
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def sqs():
with mock_sqs():
yield boto3.client("sqs", region_name="us-east-1")
示例11: setUp
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def setUp(self):
self.mock_sqs = mock_sqs()
self.mock_sqs.start()
sqs.SQSTalk._queues = {}
示例12: tearDown
# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def tearDown(self):
self.mock_sqs.stop()