test_video_show_correct_default_quality
This commit is contained in:
@@ -98,3 +98,66 @@ class VideoTestCase(TestCase):
|
||||
content
|
||||
)
|
||||
|
||||
def test_video_show_correct_default_quality(self):
|
||||
|
||||
video = factories.create(
|
||||
models.Video,
|
||||
title='Vid 1',
|
||||
slug='vid-1',
|
||||
default_quality='720p',
|
||||
)
|
||||
transcoding1 = factories.create(
|
||||
models.Transcoding,
|
||||
video=video,
|
||||
quality='480p',
|
||||
type='video/webm',
|
||||
url='http://480p.webm',
|
||||
)
|
||||
transcoding2 = factories.create(
|
||||
models.Transcoding,
|
||||
video=video,
|
||||
quality='480p',
|
||||
type='video/mp4',
|
||||
url='http://480p.mp4',
|
||||
)
|
||||
transcoding3 = factories.create(
|
||||
models.Transcoding,
|
||||
video=video,
|
||||
quality='720p',
|
||||
type='video/webm',
|
||||
url='http://720p.webm',
|
||||
)
|
||||
transcoding4 = factories.create(
|
||||
models.Transcoding,
|
||||
video=video,
|
||||
quality='720p',
|
||||
type='video/mp4',
|
||||
url='http://720p.mp4',
|
||||
)
|
||||
|
||||
resp:HttpResponse = self.client.get(reverse('video', args=['vid-1']))
|
||||
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
content:str = resp.content.decode(resp.charset)
|
||||
|
||||
srctag = '<source src="{url}" type="{type}" />'
|
||||
|
||||
self.assertInHTML(
|
||||
srctag.format(url=transcoding1.url, type=transcoding1.type),
|
||||
content,
|
||||
count=0
|
||||
)
|
||||
self.assertInHTML(
|
||||
srctag.format(url=transcoding2.url, type=transcoding2.type),
|
||||
content,
|
||||
count=0
|
||||
)
|
||||
self.assertInHTML(
|
||||
srctag.format(url=transcoding3.url, type=transcoding3.type),
|
||||
content,
|
||||
)
|
||||
self.assertInHTML(
|
||||
srctag.format(url=transcoding4.url, type=transcoding4.type),
|
||||
content,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user