Esempio n. 1
0
 def test_by_locale(self):
     eq_(set(get_featured_ids(amo.FIREFOX)),
         set(self.all_locales))
     eq_(set(get_featured_ids(amo.FIREFOX, 'xx')),
         set(self.no_locale))
     eq_(set(get_featured_ids(amo.FIREFOX, 'en-US')),
         set(self.no_locale + self.en_us_locale))
 def test_by_locale(self):
     assert set(get_featured_ids(amo.FIREFOX)) == (
         set(self.all_locales))
     assert set(get_featured_ids(amo.FIREFOX, 'xx')) == (
         set(self.no_locale))
     assert set(get_featured_ids(amo.FIREFOX, 'en-US')) == (
         set(self.no_locale + self.en_us_locale))
Esempio n. 3
0
    def filter_featured(self):
        # Featured search add-ons in all locales:
        APP, LANG = self.request.APP, self.request.LANG
        ids = get_featured_ids(APP, LANG, amo.ADDON_SEARCH)

        try:
            search_cat = Category.objects.get(slug='search-tools',
                                              application=APP.id)
            others = get_creatured_ids(search_cat, LANG)
            ids.extend(o for o in others if o not in ids)
        except Category.DoesNotExist:
            pass

        return manual_order(Addon.objects.valid(), ids, 'addons.id')
Esempio n. 4
0
    def filter_featured(self):
        # Featured search add-ons in all locales:
        APP, LANG = self.request.APP, self.request.LANG
        ids = get_featured_ids(APP, LANG, amo.ADDON_SEARCH)

        try:
            search_cat = Category.objects.get(slug='search-tools',
                                              application=APP.id)
            others = get_creatured_ids(search_cat, LANG)
            ids.extend(o for o in others if o not in ids)
        except Category.DoesNotExist:
            pass

        return manual_order(Addon.objects.valid(), ids, 'addons.id')
Esempio n. 5
0
 def test_locale_shuffle(self):
     # Make sure the locale-specific add-ons are at the front.
     ids = get_featured_ids(amo.FIREFOX, 'en-US')
     assert (ids[0], ) == self.en_us_locale
Esempio n. 6
0
 def test_by_type(self):
     assert set(get_featured_ids(amo.FIREFOX, 'xx',
                                 1)) == (set(self.no_locale_type_one))
Esempio n. 7
0
 def test_by_app(self):
     assert set(get_featured_ids(amo.FIREFOX)) == (set(self.all_locales))
Esempio n. 8
0
def get_featured_personas(request, category=None, num_personas=6):
    categories, filter, base, category = personas_listing(request, category)
    ids = get_featured_ids(request.APP, request.LANG, type=amo.ADDON_PERSONA)

    return manual_order(base, ids, 'addons.id')[:num_personas]
Esempio n. 9
0
 def test_locale_shuffle(self):
     # Make sure the locale-specific add-ons are at the front.
     ids = get_featured_ids(amo.FIREFOX, 'en-US')
     assert (ids[0],) == self.en_us_locale
Esempio n. 10
0
 def test_by_type(self):
     eq_(set(get_featured_ids(amo.FIREFOX, 'xx', 1)),
         set(self.no_locale_type_one))
Esempio n. 11
0
 def test_by_type(self):
     assert set(get_featured_ids(amo.FIREFOX, 'xx', 1)) == (
         set(self.no_locale_type_one))
Esempio n. 12
0
 def test_by_app(self):
     assert set(get_featured_ids(amo.FIREFOX)) == (
         set(self.all_locales))
Esempio n. 13
0
 def test_by_type(self):
     eq_(set(get_featured_ids(amo.FIREFOX, 'xx', 1)),
         set(self.no_locale_type_one))
Esempio n. 14
0
 def test_by_app(self):
     eq_(set(get_featured_ids(amo.FIREFOX)),
         set(self.all_locales))
Esempio n. 15
0
 def test_by_locale(self):
     eq_(set(get_featured_ids(amo.FIREFOX)), set(self.all_locales))
     eq_(set(get_featured_ids(amo.FIREFOX, 'xx')), set(self.no_locale))
     eq_(set(get_featured_ids(amo.FIREFOX, 'en-US')),
         set(self.no_locale + self.en_us_locale))
Esempio n. 16
0
def get_featured_personas(request, category=None, num_personas=6):
    categories, filter, base, category = personas_listing(request, category)
    ids = get_featured_ids(request.APP, request.LANG, type=amo.ADDON_PERSONA)

    return manual_order(base, ids, 'addons.id')[:num_personas]
Esempio n. 17
0
 def test_by_app(self):
     eq_(set(get_featured_ids(amo.FIREFOX)), set(self.all_locales))