本文整理汇总了Python中socorro.external.es.crashstorage.ESCrashStorage.close方法的典型用法代码示例。如果您正苦于以下问题:Python ESCrashStorage.close方法的具体用法?Python ESCrashStorage.close怎么用?Python ESCrashStorage.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.external.es.crashstorage.ESCrashStorage
的用法示例。
在下文中一共展示了ESCrashStorage.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_index_crash_with_bad_keys
# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import close [as 别名]
def test_index_crash_with_bad_keys(self):
a_raw_crash_with_bad_keys = {
'foo': 'alpha',
'': 'bad key 1',
'.': 'bad key 2',
u'na\xefve': 'bad key 3',
}
es_storage = ESCrashStorage(config=self.config)
es_storage.save_raw_and_processed(
raw_crash=deepcopy(a_raw_crash_with_bad_keys),
dumps=None,
processed_crash=deepcopy(a_processed_crash),
crash_id=a_processed_crash['uuid']
)
# Ensure that the document was indexed by attempting to retreive it.
doc = self.es_client.get(
index=self.config.elasticsearch.elasticsearch_index,
id=a_processed_crash['uuid']
)
# Make sure the invalid keys aren't in the crash.
raw_crash = doc['_source']['raw_crash']
assert raw_crash == {'foo': 'alpha'}
es_storage.close()
示例2: test_index_crash
# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import close [as 别名]
def test_index_crash(self):
"""Test indexing a crash document."""
es_storage = ESCrashStorage(config=self.config)
es_storage.save_raw_and_processed(
raw_crash=deepcopy(a_raw_crash),
dumps=None,
processed_crash=deepcopy(a_processed_crash),
crash_id=a_processed_crash['uuid']
)
# Ensure that the document was indexed by attempting to retreive it.
assert (
self.es_client.get(
index=es_storage.es_context.get_index_template(),
id=a_processed_crash['uuid']
)
)
es_storage.close()
示例3: test_index_crash
# 需要导入模块: from socorro.external.es.crashstorage import ESCrashStorage [as 别名]
# 或者: from socorro.external.es.crashstorage.ESCrashStorage import close [as 别名]
def test_index_crash(self):
"""Test indexing a crash document.
"""
es_storage = ESCrashStorage(config=self.config)
es_storage.save_raw_and_processed(
raw_crash=a_raw_crash,
dumps=None,
processed_crash=a_processed_crash,
crash_id=a_processed_crash['uuid']
)
# Ensure that the document was indexed by attempting to retreive it.
ok_(
self.es_client.get(
index=self.config.elasticsearch.elasticsearch_index,
id=a_processed_crash['uuid']
)
)
es_storage.close()