diff --git a/tests/videodinges/unit/models/test_get_short_name_of_transcoding_type.py b/tests/videodinges/unit/models/test_get_short_name_of_transcoding_type.py
index 1831ae4..80964ff 100644
--- a/tests/videodinges/unit/models/test_get_short_name_of_transcoding_type.py
+++ b/tests/videodinges/unit/models/test_get_short_name_of_transcoding_type.py
@@ -9,5 +9,5 @@ class GetShortNameOfTranscodingTypeTestCase(SimpleTestCase):
def test_gets_transcoding_by_transcoding_object(self):
result = get_short_name_of_transcoding_type(TranscodingType(name='Looooong naaaaame', short_name='shrt nm',
- description='Some Description'))
+ description='Some Description', priority=1))
self.assertEqual(result, 'shrt nm')
diff --git a/tests/videodinges/unit/models/test_get_transcoding_type_by_name.py b/tests/videodinges/unit/models/test_get_transcoding_type_by_name.py
new file mode 100644
index 0000000..180fa6c
--- /dev/null
+++ b/tests/videodinges/unit/models/test_get_transcoding_type_by_name.py
@@ -0,0 +1,15 @@
+from django.test import SimpleTestCase
+from videodinges.models import get_transcoding_type_by_name
+
+class GetTranscodingTypeByNameTestCase(SimpleTestCase):
+
+ def test_returns_transcoding_type_if_listed(self):
+ result = get_transcoding_type_by_name('video/webm; codecs="vp9, opus"')
+ self.assertEqual(result.name, 'video/webm; codecs="vp9, opus"')
+ self.assertEqual(result.short_name, 'vp9')
+ self.assertEqual(result.description, 'WebM with VP9 and Opus')
+ self.assertEqual(result.priority, 100)
+
+ def test_returns_none_if_not_listed(self):
+ result = get_transcoding_type_by_name('non-existent')
+ self.assertIsNone(result)
diff --git a/tests/videodinges/views/test_video.py b/tests/videodinges/views/test_video.py
index 4804f36..50478d5 100644
--- a/tests/videodinges/views/test_video.py
+++ b/tests/videodinges/views/test_video.py
@@ -59,8 +59,8 @@ class VideoTestCase(UploadMixin, TestCase):
self.assertInHTML(
"""""",
content,
@@ -129,8 +129,8 @@ class VideoTestCase(UploadMixin, TestCase):
self.assertInHTML(
"""""",
content,
@@ -190,8 +190,8 @@ class VideoTestCase(UploadMixin, TestCase):
self.assertInHTML(
"""""",
content,
@@ -245,6 +245,52 @@ class VideoTestCase(UploadMixin, TestCase):
content,
)
+ def test_video_view_renders_transcoding_types_in_correct_order(self):
+
+ video = factories.create(
+ models.Video,
+ title='Vid 1',
+ slug='vid-1',
+ default_quality='480p',
+ )
+ factories.create(
+ models.Transcoding,
+ video=video,
+ quality='480p',
+ type='video/mp4; codecs="avc1.64001e,mp4a.40.2"',
+ url='http://480p.mp4',
+ )
+ factories.create(
+ models.Transcoding,
+ video=video,
+ quality='480p',
+ type='video/webm; codecs="vp9, opus"',
+ url='http://480p.vp9.webm',
+ )
+ factories.create(
+ models.Transcoding,
+ video=video,
+ quality='480p',
+ type='video/webm; codecs="vp8, vorbis"',
+ url='http://480p.vp8.webm',
+ )
+
+ resp:HttpResponse = self.client.get(reverse('video', args=['vid-1']))
+
+ self.assertEqual(resp.status_code, 200)
+
+ content:str = resp.content.decode(resp.charset)
+
+ self.assertInHTML(
+ """""",
+ content,
+ )
+
class VideoWithTrackTestCase(UploadMixin, TestCase):
def setUp(self):
@@ -287,8 +333,8 @@ class VideoWithTrackTestCase(UploadMixin, TestCase):
self.assertInHTML(
"""""",
@@ -317,8 +363,8 @@ class VideoWithTrackTestCase(UploadMixin, TestCase):
self.assertInHTML(
f"""