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))
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')
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
def test_by_type(self): assert set(get_featured_ids(amo.FIREFOX, 'xx', 1)) == (set(self.no_locale_type_one))
def test_by_app(self): assert set(get_featured_ids(amo.FIREFOX)) == (set(self.all_locales))
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]
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
def test_by_type(self): eq_(set(get_featured_ids(amo.FIREFOX, 'xx', 1)), set(self.no_locale_type_one))
def test_by_type(self): assert set(get_featured_ids(amo.FIREFOX, 'xx', 1)) == ( set(self.no_locale_type_one))
def test_by_app(self): assert set(get_featured_ids(amo.FIREFOX)) == ( set(self.all_locales))
def test_by_app(self): eq_(set(get_featured_ids(amo.FIREFOX)), set(self.all_locales))