def test_personas_grid_sorting(self): """Ensure we hit a grid page if there is a sorting.""" category = Category( type=amo.ADDON_PERSONA, slug='abc', application=amo.FIREFOX.id) category.save() category_url = reverse('browse.personas', args=[category.slug]) response = self.client.get(category_url + '?sort=created') self.assertTemplateUsed(response, self.grid_template) # Whatever the `category.count` is. category.update(count=MIN_COUNT_FOR_LANDING + 1) response = self.client.get(category_url + '?sort=created') self.assertTemplateUsed(response, self.grid_template)
def test_personas_grid_sorting(self): """Ensure we hit a grid page if there is a sorting.""" category = Category( type=amo.ADDON_PERSONA, slug='abc', application=amo.FIREFOX.id) category.save() category_url = reverse('browse.personas', args=[category.slug]) r = self.client.get(category_url + '?sort=created') self.assertTemplateUsed(r, self.grid_template) # Whatever the `category.count` is. category.update(count=MIN_COUNT_FOR_LANDING + 1) r = self.client.get(category_url + '?sort=created') self.assertTemplateUsed(r, self.grid_template)
def test_personas_landing(self): """ Show landing page if there are greater than MIN_COUNT_FOR_LANDING popular Personas. """ self.create_personas(MIN_COUNT_FOR_LANDING, persona_extras={'popularity': 100}) base = Addon.objects.public().filter(type=amo.ADDON_PERSONA) assert base.count() == MIN_COUNT_FOR_LANDING + 2 response = self.client.get(self.landing_url) self.assertTemplateUsed(response, self.landing_template) # Whatever the `category.count` is. category = Category( type=amo.ADDON_PERSONA, slug='abc', count=MIN_COUNT_FOR_LANDING + 1, application=amo.FIREFOX.id) category.save() response = self.client.get(self.landing_url) self.assertTemplateUsed(response, self.landing_template)
def test_personas_landing(self): """ Show landing page if there are greater than MIN_COUNT_FOR_LANDING popular Personas. """ self.create_personas(MIN_COUNT_FOR_LANDING, persona_extras={'popularity': 100}) base = Addon.objects.public().filter(type=amo.ADDON_PERSONA) assert base.count() == MIN_COUNT_FOR_LANDING + 2 r = self.client.get(self.landing_url) self.assertTemplateUsed(r, self.landing_template) # Whatever the `category.count` is. category = Category( type=amo.ADDON_PERSONA, slug='abc', count=MIN_COUNT_FOR_LANDING + 1, application=amo.FIREFOX.id) category.save() response = self.client.get(self.landing_url) self.assertTemplateUsed(response, self.landing_template)