Exemple #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
    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
Exemple #3
0
def flag_database(new_index, old_index, alias):
    """Flags the database to indicate that the reindexing has started."""
    logger.info('Flagging the database to start the reindexation')
    flag_reindexing_amo(new_index=new_index, old_index=old_index, alias=alias)
Exemple #4
0
def flag_database(new_index, old_index, alias, stdout=sys.stdout):
    """Flags the database to indicate that the reindexing has started."""
    log('Flagging the database to start the reindexation', stdout=stdout)
    flag_reindexing_amo(new_index=new_index, old_index=old_index, alias=alias)
def flag_database(new_index, old_index, alias, stdout=sys.stdout):
    """Flags the database to indicate that the reindexing has started."""
    log("Flagging the database to start the reindexation", stdout=stdout)
    flag_reindexing_amo(new_index=new_index, old_index=old_index, alias=alias)
Exemple #6
0
def flag_database(new_index, old_index, alias):
    """Flags the database to indicate that the reindexing has started."""
    logger.info('Flagging the database to start the reindexation')
    flag_reindexing_amo(new_index=new_index, old_index=old_index, alias=alias)