def test_weekly_downloads_flagged(self): eq_(self.get_webapp().weekly_downloads, 0) self.add_install() self.add_install(user=UserProfile.objects.get(pk=10482), created=datetime.today() - timedelta(days=2)) flag_reindexing_mkt('new', 'old', 'alias') try: # Should fail. self.assertRaises(CommandError, update_weekly_downloads) eq_(self.get_webapp().weekly_downloads, 0) # Should work with the environ flag. os.environ['FORCE_INDEXING'] = '1' update_weekly_downloads() finally: unflag_reindexing_mkt() del os.environ['FORCE_INDEXING'] eq_(self.get_webapp().weekly_downloads, 2)
def unflag_database(): """Unflag the database to indicate that the reindexing is over.""" sys.stdout.write('Unflagging the database') unflag_reindexing_mkt()