'Verify the data we are indexing.'

def test_data_in_index(self):

    p = ProductFactory()
    q = QuestionFactory(locale='pt-BR', product=p)
    a = AnswerFactory(question=q)
    self.refresh()
    eq_(AnswerMetricsMappingType.search().count(), 1)
    data = AnswerMetricsMappingType.search()[0]
    eq_(data['locale'], q.locale)
    eq_(data['product'], [p.slug])
    eq_(data['creator_id'], a.creator_id)
    eq_(data['is_solution'], False)
    eq_(data['by_asker'], False)
    q.solution = a
    q.save()
    self.refresh()
    data = AnswerMetricsMappingType.search()[0]
    eq_(data['is_solution'], True)
    a.creator = q.creator
    a.save()
    self.refresh()
    data = AnswerMetricsMappingType.search()[0]
    eq_(data['by_asker'], True)
