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


Python ESCrashStorage.get_index_for_crash方法代码示例

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


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

示例1: test_get_index_for_crash_dynamic_name

# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import get_index_for_crash [as 别名]
    def test_get_index_for_crash_dynamic_name(self):
        """Test a dynamic (date-based) index name.
        """

        # The crashstorage class looks for '%' in the index name; if that
        # symbol is present, it will attempt to generate a new date-based
        # index name. Since the test base config doesn't use this pattern,
        # we need to specify it now.
        modified_config = self.get_tuned_config(
            ESCrashStorage,
            {'resource.elasticsearch.elasticsearch_index':
                'socorro_integration_test_reports%Y%m%d'}
        )
        es_storage = ESCrashStorage(config=modified_config)

        # The date is used to generate the name of the index; it must be a
        # datetime object.
        date = string_to_datetime(
            a_processed_crash['client_crash_date']
        )
        index = es_storage.get_index_for_crash(date)

        # The base index name is obtained from the test base class and the
        # date is appended to it according to pattern specified above.
        ok_(type(index) is str)
        eq_(index, 'socorro_integration_test_reports20120408')
开发者ID:ahlfors,项目名称:socorro,代码行数:28,代码来源:test_crashstorage.py

示例2: test_get_index_for_crash_static_name

# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import get_index_for_crash [as 别名]
    def test_get_index_for_crash_static_name(self):
        """Test a static index name """
        es_storage = ESCrashStorage(config=self.config)

        # The actual date isn't important since the index name won't use it.
        index = es_storage.get_index_for_crash('some_date')

        # The index name is obtained from the test base class.
        assert type(index) is str
        assert index == 'socorro_integration_test_reports'
开发者ID:willkg,项目名称:socorro,代码行数:12,代码来源:test_crashstorage.py


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