Add get_transcoding_type_by_name()

This commit is contained in:
2022-04-06 19:51:41 +02:00
parent 48473b2a90
commit 60accdc618
2 changed files with 20 additions and 0 deletions

View File

@@ -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)