本文整理汇总了Python中fjord.feedback.models.ResponseMappingType.refresh_index方法的典型用法代码示例。如果您正苦于以下问题:Python ResponseMappingType.refresh_index方法的具体用法?Python ResponseMappingType.refresh_index怎么用?Python ResponseMappingType.refresh_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fjord.feedback.models.ResponseMappingType
的用法示例。
在下文中一共展示了ResponseMappingType.refresh_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_index_chunk_task
# 需要导入模块: from fjord.feedback.models import ResponseMappingType [as 别名]
# 或者: from fjord.feedback.models.ResponseMappingType import refresh_index [as 别名]
def test_index_chunk_task(self):
responses = [response(save=True) for i in range(10)]
# With live indexing, that'll create items in the index. Since
# we want to test index_chunk_test, we need a clean index to
# start with so we delete and recreate it.
self.setup_indexes(empty=True)
# Verify there's nothing in the index.
eq_(len(ResponseMappingType.search()), 0)
# Create the record and the chunk and then run it through
# celery.
batch_id = 'ou812'
rec = record(batch_id=batch_id, save=True)
chunk = (ResponseMappingType, [item.id for item in responses])
index_chunk_task.delay(get_index(), batch_id, rec.id, chunk)
ResponseMappingType.refresh_index()
# Verify everything is in the index now.
eq_(len(ResponseMappingType.search()), 10)
# Verify the record was marked succeeded.
rec = Record.objects.get(pk=rec.id)
eq_(rec.status, Record.STATUS_SUCCESS)