def test_computing_recent_events(self): mock_cache = mock.MagicMock() with mock.patch('opendebates.tasks.cache', new=mock_cache): update_recent_events() mock_cache.set.assert_any_call(RECENT_EVENTS_CACHE_ENTRY, [self.vote, self.vote.submission], 24 * 3600) num = Vote.objects.count() mock_cache.set.assert_any_call(NUMBER_OF_VOTES_CACHE_ENTRY, num, 24 * 3600)
def test_computing_recent_events(self): mock_cache = mock.MagicMock() with mock.patch('opendebates.tasks.cache', new=mock_cache): update_recent_events() mock_cache.set.assert_any_call( RECENT_EVENTS_CACHE_ENTRY, [self.vote, self.vote.submission], 300 ) num = Vote.objects.count() mock_cache.set.assert_any_call(NUMBER_OF_VOTES_CACHE_ENTRY, num, 300)
def handle(self, *args, **options): update_recent_events()