'Search questions for products.'

def test_question_products(self):

    p1 = ProductFactory(slug='b2g')
    p2 = ProductFactory(slug='mobile')
    p3 = ProductFactory(slug='desktop')
    QuestionFactory(product=p2)
    QuestionFactory(product=p2)
    QuestionFactory(product=p3)
    self.refresh()
    product_vals = ((p1.slug, 0), (p2.slug, 2), (p3.slug, 1))
    qs = {'a': 1, 'w': 2, 'format': 'json'}
    for (products, number) in product_vals:
        qs.update({'product': products})
        response = self.client.get(reverse('search.advanced'), qs)
        eq_(number, json.loads(response.content)['total'])
