def test_missing_lang_no_fail(self): # when sending a nonexisting lang, we should end up with the original lang, since # others might have been cleared and not gotten through the cache # we are asserting this won't raise an exception for https://www.pivotaltracker.com/story/show/15348901 url = "http://videos-cdn.mozilla.net/serv/mozhacks/demos/screencasts/londonproject/screencast.ogv" cache_key = video_cache._video_id_key(url) video_cache.cache.set(cache_key, "", video_cache.TIMEOUT) video_id = video_cache.get_video_id(url) video_cache.get_subtitles_dict(video_id, 0, 0, lambda x: x)
def test_empty_id_show_widget(self): url = "http://videos-cdn.mozilla.net/serv/mozhacks/demos/screencasts/londonproject/screencast.ogv" cache_key = video_cache._video_id_key(url) video, create = Video.get_or_create_for_url(url) video_cache.cache.set(cache_key, "", video_cache.TIMEOUT) # we have a bogus url video_id = video_cache.get_video_id(url) self.assertTrue(bool(video_id)) try: Video.objects.get(video_id=video_id) except Video.DoesNotExist: self.fail("Should not point to a non existing video")
def test_video_id_not_empty_string(self): url = "http://videos-cdn.mozilla.net/serv/mozhacks/demos/screencasts/londonproject/screencast.ogv" cache_key = video_cache._video_id_key(url) video_cache.cache.set(cache_key, "", video_cache.TIMEOUT) video_id = video_cache.get_video_id(url) self.assertTrue(bool(video_id))