当前位置: 首页>>代码示例>>Python>>正文


Python moto.mock_sqs方法代码示例

本文整理汇总了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 
开发者ID:Netflix-Skunkworks,项目名称:historical,代码行数:23,代码来源:conftest.py

示例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() 
开发者ID:Yelp,项目名称:clusterman,代码行数:20,代码来源:environment.py

示例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 
开发者ID:servian,项目名称:aws-auto-remediate,代码行数:6,代码来源:test_dlq.py

示例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))) 
开发者ID:tdsmith,项目名称:github-snooze-button,代码行数:4,代码来源:test_repository_listener.py

示例5: __init__

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def __init__(self):
        self.mock_sqs = None 
开发者ID:jhuapl-boss,项目名称:boss,代码行数:4,代码来源:setup.py

示例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() 
开发者ID:jhuapl-boss,项目名称:boss,代码行数:7,代码来源:setup.py

示例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 ***** 
开发者ID:jhuapl-boss,项目名称:boss,代码行数:7,代码来源:setup.py

示例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 
开发者ID:jhuapl-boss,项目名称:boss,代码行数:10,代码来源:setup.py

示例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 ***** 
开发者ID:jhuapl-boss,项目名称:boss,代码行数:9,代码来源:setup.py

示例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") 
开发者ID:Netflix-Skunkworks,项目名称:raven-python-lambda,代码行数:5,代码来源:conftest.py

示例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 = {} 
开发者ID:Nextdoor,项目名称:ndkale,代码行数:6,代码来源:test_consumer.py

示例12: tearDown

# 需要导入模块: import moto [as 别名]
# 或者: from moto import mock_sqs [as 别名]
def tearDown(self):
        self.mock_sqs.stop() 
开发者ID:Nextdoor,项目名称:ndkale,代码行数:4,代码来源:test_consumer.py


注:本文中的moto.mock_sqs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。