Ejemplo n.º 1
0
 def test_viewcount_updated(self):
     """Test that videos with viewcounts in the cache are updated."""
     with build_video(self.user, views=10) as video:
         cache.set(VIEWS_KEY % video.id, 14)
         eq_(Video.objects.get(id=video.id).views, 10)
         persist_viewcounts()
         eq_(Video.objects.get(id=video.id).views, 14)
Ejemplo n.º 2
0
 def test_viewcount_unmodified(self):
     """Test that videos without viewcounts in the cache are not updated."""
     with build_video(self.user, views=10) as video:
         eq_(Video.objects.get(id=video.id).views, 10)
         persist_viewcounts()
         eq_(Video.objects.get(id=video.id).views, 10)
Ejemplo n.º 3
0
 def test_no_videos(self):
     """Test that the cron doesn't fail with no videos."""
     Video.objects.all().delete()
     persist_viewcounts()