Ejemplo n.º 1
0
    def test_expire_cache_at_end_of_day(self, cache_set):
        """When we cache today's random sound, expire the cache at midnight today"""

        sound = Sound.objects.get(id=19)
        sotd = SoundOfTheDay.objects.create(sound=sound, date_display=datetime.date(2017, 06, 20))
        sound_id = get_sound_of_the_day_id()
        cache_set.assert_called_with("random_sound", 19, 48600)
Ejemplo n.º 2
0
 def test_random_sound(self):
     sound = Sound.objects.get(id=19)
     SoundOfTheDay.objects.create(sound=sound,
                                  date_display=datetime.date.today())
     random_sound = get_sound_of_the_day_id()
     self.assertEqual(isinstance(random_sound, int), True)
Ejemplo n.º 3
0
 def test_no_random_sound(self):
     # If we have no sound, return None
     random_sound_id = get_sound_of_the_day_id()
     self.assertIsNone(random_sound_id)