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

def test_wiki_products(self):

    p = ProductFactory(slug=u'desktop')
    eq_(DocumentMappingType.search().filter(product=p.slug).count(), 0)
    doc = DocumentFactory()
    RevisionFactory(document=doc, is_approved=True)
    self.refresh()
    eq_(DocumentMappingType.search().filter(product=p.slug).count(), 0)
    doc.products.add(p)
    self.refresh()
    eq_(DocumentMappingType.search().filter(product=p.slug).count(), 1)
    doc.products.remove(p)
    self.refresh()
    eq_(DocumentMappingType.search().filter().count(), 1)
    eq_(DocumentMappingType.search().filter(product=p.slug).count(), 0)
