Example #1
0
 def setUp(self):
     super(TestMultiSearchView, self).setUp()
     post_request_task._start_queuing_tasks()
     self.url = reverse('fireplace-multi-search-api')
     self.webapp = Webapp.objects.get(pk=337141)
     self.webapp.save()
     self.extension = Extension.objects.create(name='test-ext-lol')
     self.extension.versions.create(status=STATUS_PUBLIC)
     self.extension.popularity.add(ExtensionPopularity(region=0, value=999))
     self.extension.save()
     post_request_task._send_tasks_and_stop_queuing()
     self.refresh(doctypes=('extension', 'webapp', 'homescreen'))
Example #2
0
 def make_homescreen(self):
     post_request_task._start_queuing_tasks()
     self.homescreen = app_factory(name=u'Elegant Waffle',
                                   description=u'homescreen runner',
                                   created=self.days_ago(5),
                                   manifest_url='http://h.testmanifest.com')
     Tag(tag_text='homescreen').save_tag(self.homescreen)
     self.homescreen.addondevicetype_set.create(
         device_type=mkt.DEVICE_GAIA.id)
     self.homescreen.update_version()
     self.homescreen.update(categories=['health-fitness', 'productivity'])
     post_request_task._send_tasks_and_stop_queuing()
     self.refresh(('webapp', 'website', 'extension', 'homescreen'))
     return self.homescreen
Example #3
0
 def make_homescreen(self):
     post_request_task._start_queuing_tasks()
     self.homescreen = app_factory(name=u'Elegant Waffle',
                                   description=u'homescreen runner',
                                   created=self.days_ago(5),
                                   manifest_url='http://h.testmanifest.com')
     Tag(tag_text='homescreen').save_tag(self.homescreen)
     self.homescreen.addondevicetype_set.create(
         device_type=mkt.DEVICE_GAIA.id)
     self.homescreen.update_version()
     self.homescreen.update(categories=['health-fitness', 'productivity'])
     post_request_task._send_tasks_and_stop_queuing()
     self.refresh(('webapp', 'extension', 'homescreen'))
     return self.homescreen
Example #4
0
    def refresh(cls, doctypes=None):
        """
        Force an immediate refresh for the index(es) holding the given
        doctype(s) in ES. Both a string corresponding to a single doctypes or a
        list of multiple doctypes are accepted.

        If there are tasks in the post_request_task queue, they are processed
        first.
        """
        post_request_task._send_tasks_and_stop_queuing()

        if doctypes:
            if not isinstance(doctypes, (list, tuple)):
                doctypes = [doctypes]
            indexes = [settings.ES_INDEXES[doctype] for doctype in doctypes]
            try:
                cls.es.indices.refresh(index=indexes)
            except elasticsearch.NotFoundError as e:
                print "Could not refresh indexes '%s': %s" % (indexes, e)
Example #5
0
def resume_all_tasks():
    _send_tasks_and_stop_queuing()
Example #6
0
def resume_all_tasks():
    _send_tasks_and_stop_queuing()
Example #7
0
 def tearDown(self):
     post_request_task._send_tasks_and_stop_queuing()
     super(ESTestCase, self).tearDown()