Пример #1
0
 def setUp(cls):
     super(ESTestCaseWithAddons, cls).setUpClass()
     # Load the fixture here, to not be overloaded by a child class'
     # fixture attribute.
     call_command('loaddata', 'addons/base_es')
     addon_ids = [1, 2, 3, 4, 5, 6]  # From the addons/base_es fixture.
     cls._addons = list(Addon.objects.filter(pk__in=addon_ids)
                        .order_by('id'))
     from addons.tasks import index_addons
     index_addons(addon_ids)
     # Refresh ES.
     cls.refresh()
Пример #2
0
    def setUp(self):
        super(TestSuggestions, self).setUp()
        self.url = reverse('search.apps_ajax')

        self.c1 = Category.objects.create(name='groovy',
            type=amo.ADDON_WEBAPP)
        self.c2 = Category.objects.create(name='awesome',
            type=amo.ADDON_WEBAPP)

        self.w1 = Webapp.objects.create(status=amo.STATUS_PUBLIC,
            name='groovy app 1')
        self.w2 = Webapp.objects.create(status=amo.STATUS_PUBLIC,
            name='awesome app 2')

        self.w1.addoncategory_set.create(category=self.c1)
        self.w2.addoncategory_set.create(category=self.c2)

        index_addons([self.w1.id, self.w2.id])
        self.refresh()