'Make sure that adding topics to a Document causes it to
refresh the index.'

def test_wiki_topics(self):

    t = TopicFactory(slug=u'hiphop')
    eq_(DocumentMappingType.search().filter(topic=t.slug).count(), 0)
    doc = DocumentFactory()
    RevisionFactory(document=doc, is_approved=True)
    self.refresh()
    eq_(DocumentMappingType.search().filter(topic=t.slug).count(), 0)
    doc.topics.add(t)
    self.refresh()
    eq_(DocumentMappingType.search().filter(topic=t.slug).count(), 1)
    doc.topics.clear()
    self.refresh()
    eq_(DocumentMappingType.search().filter().count(), 1)
    eq_(DocumentMappingType.search().filter(topic=t.slug).count(), 0)
