Exemple #1
0
    def tearDown(self):
        # Taken from MultiSearchView test.
        for w in Webapp.objects.all():
            w.delete()
        for w in Website.objects.all():
            w.delete()
        super(TestDailyGamesView, self).tearDown()

        Webapp.get_indexer().unindexer(_all=True)
        Website.get_indexer().unindexer(_all=True)
        self.refresh(('webapp', 'website'))
Exemple #2
0
    def tearDown(self):
        # Taken from MultiSearchView test.
        for w in Webapp.objects.all():
            w.delete()
        for w in Website.objects.all():
            w.delete()
        super(TestDailyGamesView, self).tearDown()

        Webapp.get_indexer().unindexer(_all=True)
        Website.get_indexer().unindexer(_all=True)
        self.refresh(('webapp', 'website'))
Exemple #3
0
    def tearDown(self):
        for o in Webapp.objects.all():
            o.delete()
        for o in Website.objects.all():
            o.delete()
        for o in Extension.objects.all():
            o.delete()
        super(TestMultiSearchView, self).tearDown()

        # Make sure to delete and unindex *all* things. Normally we wouldn't
        # care about stray deleted content staying in the index, but they can
        # have an impact on relevancy scoring so we need to make sure. This
        # needs to happen after super() has been called since it'll process the
        # indexing tasks that should happen post_request, and we need to wait
        # for ES to have done everything before continuing.
        Webapp.get_indexer().unindexer(_all=True)
        Website.get_indexer().unindexer(_all=True)
        Extension.get_indexer().unindexer(_all=True)
        self.refresh(('webapp', 'website', 'extension'))
Exemple #4
0
    def tearDown(self):
        for o in Webapp.objects.all():
            o.delete()
        for o in Website.objects.all():
            o.delete()
        for o in Extension.objects.all():
            o.delete()
        super(TestMultiSearchView, self).tearDown()

        # Make sure to delete and unindex *all* things. Normally we wouldn't
        # care about stray deleted content staying in the index, but they can
        # have an impact on relevancy scoring so we need to make sure. This
        # needs to happen after super() has been called since it'll process the
        # indexing tasks that should happen post_request, and we need to wait
        # for ES to have done everything before continuing.
        Webapp.get_indexer().unindexer(_all=True)
        Website.get_indexer().unindexer(_all=True)
        Extension.get_indexer().unindexer(_all=True)
        HomescreenIndexer.unindexer(_all=True)
        self.refresh(('webapp', 'website', 'extension', 'homescreen'))
Exemple #5
0
    def test_q_num_requests(self):
        es = Website.get_indexer().get_es()
        orig_search = es.search
        es.counter = 0

        def monkey_search(*args, **kwargs):
            es.counter += 1
            return orig_search(*args, **kwargs)

        es.search = monkey_search

        with self.assertNumQueries(0):
            res = self.anon.get(self.url, data={'q': 'something'})
        eq_(res.status_code, 200)
        eq_(res.json['meta']['total_count'], 1)
        eq_(len(res.json['objects']), 1)

        # Verify only one search call was made.
        eq_(es.counter, 1)

        es.search = orig_search
Exemple #6
0
    def test_q_num_requests(self):
        es = Website.get_indexer().get_es()
        orig_search = es.search
        es.counter = 0

        def monkey_search(*args, **kwargs):
            es.counter += 1
            return orig_search(*args, **kwargs)

        es.search = monkey_search

        with self.assertNumQueries(0):
            res = self.anon.get(self.url, data={'q': 'something'})
        eq_(res.status_code, 200)
        eq_(res.json['meta']['total_count'], 1)
        eq_(len(res.json['objects']), 1)

        # Verify only one search call was made.
        eq_(es.counter, 1)

        es.search = orig_search
Exemple #7
0
 def tearDown(self):
     Website.get_indexer().unindexer(_all=True)
     super(TestMultiSearchView, self).tearDown()
Exemple #8
0
 def tearDown(self):
     Website.get_indexer().unindexer(_all=True)
     super(TestWebsiteESView, self).tearDown()
Exemple #9
0
 def setUp(self):
     self.indexer = Website.get_indexer()()
Exemple #10
0
 def setUp(self):
     self.indexer = Website.get_indexer()()
Exemple #11
0
 def tearDown(self):
     Website.get_indexer().unindexer(_all=True)
     super(TestReviewerSearch, self).tearDown()
Exemple #12
0
 def tearDown(self):
     Website.get_indexer().unindexer(_all=True)
     super(TestWebsiteESView, self).tearDown()
Exemple #13
0
 def tearDown(self):
     Website.get_indexer().unindexer(_all=True)
     super(TestReviewerSearch, self).tearDown()
Exemple #14
0
 def tearDown(self):
     Webapp.get_indexer().unindexer(_all=True)
     Website.get_indexer().unindexer(_all=True)
     super(TestMultiSearchView, self).tearDown()