'Search wiki for products.'

def test_wiki_products(self):

    prod_vals = ((ProductFactory(slug='b2g'), 0), (ProductFactory(slug='mobile'), 1), (ProductFactory(slug='desktop'), 2))
    for (prod, total) in prod_vals:
        for i in range(total):
            doc = DocumentFactory(locale=u'en-US', category=10)
            doc.products.add(prod)
            RevisionFactory(document=doc, is_approved=True)
    self.refresh()
    qs = {'a': 1, 'w': 1, 'format': 'json'}
    for (prod, total) in prod_vals:
        qs.update({'product': prod.slug})
        response = self.client.get(reverse('search.advanced'), qs)
        eq_(total, json.loads(response.content)['total'])
