def setUp(self): self.fetched_image = PhotoFactory(twitter_id=99999999, image_file='downloaded.jpg') self.image = PhotoFactory( twitter_id=88888888, image_file='', image_url='https://pbs.twimg.com/media/abcdefghijklmno.png') self.animated_gif = AnimatedGifFactory( twitter_id=77777777, image_url= 'https://pbs.twimg.com/tweet_video_thumb/1234567890abcde.png', mp4_url='https://pbs.twimg.com/tweet_video/abcde1234567890.mp4', image_file='', mp4_file='') self.video = VideoFactory( twitter_id=66666666, image_url= 'https://pbs.twimg.com/ext_tw_video_thumb/740282905369444352/pu/img/zyxwvutsrqponml.jpg', image_file='', mp4_file='')
def test_video_url_dash(self): "Will be same as remote URL." video = VideoFactory(xmpeg_url='', dash_url='https://example.org/test.mpd') self.assertEqual(video.video_url, video.dash_url)
def test_video_mime_type_dash(self): video = VideoFactory(xmpeg_url='', dash_url='https://example.org/test.mpd') self.assertEqual(video.video_mime_type, 'application/dash+xml')
def test_video_mime_type_xmpeg(self): video = VideoFactory(xmpeg_url='https://example.org/test.m3u8') self.assertEqual(video.video_mime_type, 'application/x-mpegURL')
def test_video_url_empty(self): video = VideoFactory(xmpeg_url='', mp4_url='', dash_url='') self.assertEqual(video.video_url, '')
def test_video_url_mp4(self): video = VideoFactory(xmpeg_url='', dash_url='', mp4_url='https://example.org/test.mp4') self.assertEqual(video.video_url, video.mp4_url)
def test_video_url_xmpeg(self): video = VideoFactory(xmpeg_url='https://example.org/test.m3u8') self.assertEqual(video.video_url, video.xmpeg_url)
def test_media_type(self): video = VideoFactory() self.assertEqual(video.media_type, 'video')
def test_str(self): video = VideoFactory() self.assertEqual(video.__str__(), 'Video %d' % video.id)