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


Python DotDict.bucket_name方法代码示例

本文整理汇总了Python中socorro.lib.util.DotDict.bucket_name方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.bucket_name方法的具体用法?Python DotDict.bucket_name怎么用?Python DotDict.bucket_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在socorro.lib.util.DotDict的用法示例。


在下文中一共展示了DotDict.bucket_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_mocked_s3_storage

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import bucket_name [as 别名]
    def setup_mocked_s3_storage(
        self,
        executor=TransactionExecutor,
        executor_for_gets=TransactionExecutor,
        keybuilder_class=KeyBuilderBase,
        storage_class='BotoS3CrashStorage',
        bucket_name='mozilla-support-reason',
        host='',
        port=0,
    ):
        config = DotDict({
            'source': {
                'dump_field': 'dump'
            },
            'transaction_executor_class': executor,
            'transaction_executor_class_for_get': executor_for_gets,
            'resource_class': S3ConnectionContext,
            'keybuilder_class': keybuilder_class,
            'backoff_delays': [0, 0, 0],
            'redactor_class': Redactor,
            'forbidden_keys': Redactor.required_config.forbidden_keys.default,
            'logger': mock.Mock(),
            'host': host,
            'port': port,
            'access_key': 'this is the access key',
            'secret_access_key': 'secrets',
            'temporary_file_system_storage_path': self.TEMPDIR,
            'dump_file_suffix': '.dump',
            'bucket_name': bucket_name,
            'prefix': 'dev',
            'calling_format': mock.Mock(),
            'json_object_hook': DotDict,
        })

        if isinstance(storage_class, basestring):
            if storage_class == 'BotoS3CrashStorage':
                config.bucket_name = 'crash_storage'
                s3 = BotoS3CrashStorage(config)
            elif storage_class == 'SupportReasonAPIStorage':
                s3 = SupportReasonAPIStorage(config)
        else:
            s3 = storage_class(config)
        s3_conn = s3.connection_source
        s3_conn._connect_to_endpoint = mock.Mock()
        s3_conn._mocked_connection = s3_conn._connect_to_endpoint.return_value
        s3_conn._calling_format.return_value = mock.Mock()
        s3_conn._CreateError = mock.Mock()
        s3_conn._open = mock.MagicMock()

        return s3
开发者ID:Krispy2009,项目名称:socorro,代码行数:52,代码来源:test_crashstorage.py

示例2: setup_mocked_s3_storage

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import bucket_name [as 别名]
    def setup_mocked_s3_storage(
            self,
            executor=TransactionExecutor,
            executor_for_gets=TransactionExecutor,
            storage_class='BotoS3CrashStorage',
            host='',
            port=0):

        config = DotDict({
            'source': {
                'dump_field': 'dump'
            },
            'transaction_executor_class': executor,
            'transaction_executor_class_for_get': executor_for_gets,
            'backoff_delays': [0, 0, 0],
            'redactor_class': Redactor,
            'forbidden_keys': Redactor.required_config.forbidden_keys.default,
            'logger': mock.Mock(),
            'host': host,
            'port': port,
            'access_key': 'this is the access key',
            'secret_access_key': 'secrets',
            'temporary_file_system_storage_path':
            '/i/am/hiding/junk/files/here',
            'dump_file_suffix': '.dump',
            'bucket_name': 'mozilla-support-reason',
            'prefix': 'dev',
            'calling_format': mock.Mock()
        })
        if storage_class == 'BotoS3CrashStorage':
            config.bucket_name = 'crash_storage'
            s3 = BotoS3CrashStorage(config)
        elif storage_class == 'SupportReasonAPIStorage':
            s3 = SupportReasonAPIStorage(config)
        s3._connect_to_endpoint = mock.Mock()
        s3._mocked_connection = s3._connect_to_endpoint.return_value
        s3._calling_format.return_value = mock.Mock()
        s3._CreateError = mock.Mock()
        s3._S3ResponseError = mock.Mock()
        s3._open = mock.MagicMock()
        return s3
开发者ID:FrostburnStudios,项目名称:socorro,代码行数:43,代码来源:test_crashstorage.py


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