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()

        # Make sure the document itself is still there and that we didn't
        # accidentally delete it through screwed up signal handling:
        eq_(DocumentMappingType.search().filter().count(), 1)

        eq_(DocumentMappingType.search().filter(topic=t.slug).count(), 0)
Make sure that adding topics to a Document causes it to
dataset/ETHPy150Open mozilla/kitsune/kitsune/wiki/tests/test_es.py/DocumentUpdateTests.test_wiki_topics