示例#1
0
    def test_adu_flag(self):
        addon = Addon.objects.get(pk=3615)

        now = datetime.datetime.now()
        counter = UpdateCount.objects.create(addon=addon, date=now,
                                             count=1234)
        counter.save()

        assert \
            addon.average_daily_users > addon.total_downloads + 10000, \
            ('Unexpected ADU count. ADU of %d not greater than %d' % (
                addon.average_daily_users, addon.total_downloads + 10000))

        adu = cron.update_addon_average_daily_users
        flag_reindexing_amo('new', 'old', 'alias')
        try:
            # Should fail.
            self.assertRaises(CommandError, adu)

            # Should work with the environ flag.
            os.environ['FORCE_INDEXING'] = '1'
            adu()
        finally:
            unflag_reindexing_amo()
            os.environ.pop('FORCE_INDEXING', None)

        addon = Addon.objects.get(pk=3615)
        assert addon.average_daily_users == 1234
示例#2
0
    def test_adu_flag(self):
        addon = Addon.objects.get(pk=3615)

        now = datetime.datetime.now()
        counter = UpdateCount.objects.create(addon=addon, date=now,
                                             count=1234)
        counter.save()

        assert \
            addon.average_daily_users > addon.total_downloads + 10000, \
            ('Unexpected ADU count. ADU of %d not greater than %d' % (
                addon.average_daily_users, addon.total_downloads + 10000))

        adu = cron.update_addon_average_daily_users
        flag_reindexing_amo('new', 'old', 'alias')
        try:
            # Should fail.
            self.assertRaises(CommandError, adu)

            # Should work with the environ flag.
            os.environ['FORCE_INDEXING'] = '1'
            adu()
        finally:
            unflag_reindexing_amo()
            os.environ.pop('FORCE_INDEXING', None)

        addon = Addon.objects.get(pk=3615)
        assert addon.average_daily_users == 1234
示例#3
0
    def setUp(self):
        super(TestIndexCommand, self).setUp()
        if is_reindexing_amo():
            unflag_reindexing_amo()

        self.url = reverse('search.search')

        # We store previously existing indices in order to delete the ones
        # created during this test run.
        self.indices = self.es.indices.status()['indices'].keys()
示例#4
0
    def setUp(self):
        super(TestIndexCommand, self).setUp()
        if is_reindexing_amo():
            unflag_reindexing_amo()

        self.url = reverse('search.search')

        # We store previously existing indices in order to delete the ones
        # created during this test run.
        self.indices = self.es.indices.stats()['indices'].keys()
示例#5
0
    def setUp(self):
        super(TestIndexCommand, self).setUp()
        if is_reindexing_amo():
            unflag_reindexing_amo()

        self.url = reverse_ns('addon-search')

        # We store previously existing indices in order to delete the ones
        # created during this test run.
        self.indices = self.es.indices.stats()['indices'].keys()

        self.addons = []
        self.expected = self.addons[:]
        # Monkeypatch Celerys ".get()" inside async task error
        # until https://github.com/celery/celery/issues/4661 (which isn't just
        # about retries but a general regression that manifests only in
        # eager-mode) fixed.
        self.patch('celery.app.task.denied_join_result')
示例#6
0
def unflag_database():
    """Unflag the database to indicate that the reindexing is over."""
    logger.info('Unflagging the database')
    unflag_reindexing_amo()
示例#7
0
def unflag_database(stdout=sys.stdout):
    """Unflag the database to indicate that the reindexing is over."""
    log('Unflagging the database', stdout=stdout)
    unflag_reindexing_amo()
示例#8
0
def unflag_database(stdout=sys.stdout):
    """Unflag the database to indicate that the reindexing is over."""
    log("Unflagging the database", stdout=stdout)
    unflag_reindexing_amo()
示例#9
0
def unflag_database():
    """Unflag the database to indicate that the reindexing is over."""
    logger.info('Unflagging the database')
    unflag_reindexing_amo()