Example #1
0
    def test_personas_category_landing(self):
        """Ensure we hit a grid page if there's a category and no sorting."""
        grid = 'browse/personas/grid.html'
        landing = 'browse/personas/category_landing.html'

        category = Category(type=amo.ADDON_PERSONA, slug='abc',
            application=Application.objects.get(id=amo.FIREFOX.id))
        category.save()
        category_url = reverse('browse.personas', args=[category.slug])

        r = self.client.get(category_url + '?sort=created')
        self.assertTemplateUsed(r, grid)

        r = self.client.get(category_url)
        self.assertTemplateUsed(r, grid)

        # Category with 5 add-ons should bring us to a landing page.
        category.count = 5
        category.save()
        r = self.client.get(category_url)
        self.assertTemplateUsed(r, landing)
Example #2
0
    def test_personas_grid(self):
        """Ensure we always hit a grid page if there's a category."""
        grid = 'browse/personas/mobile/grid.html'

        category = Category(type=amo.ADDON_PERSONA, slug='xxx',
                            application_id=amo.FIREFOX.id)
        category.save()
        category_url = reverse('browse.personas', args=[category.slug])

        # Show the grid page even with sorting.
        r = self.client.get('%s?sort=created' % category_url)
        self.assertTemplateUsed(r, grid)

        r = self.client.get(category_url)
        self.assertTemplateUsed(r, grid)

        # Even if the category has 5 add-ons.
        category.count = 5
        category.save()
        r = self.client.get(category_url)
        self.assertTemplateUsed(r, grid)