65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
import unittest
|
|
|
|
from db_utils import get_mime_from_mediainfo
|
|
|
|
|
|
class TestGetMimeFromMediainfo(unittest.TestCase):
|
|
|
|
def test_master_prores_returns_quicktime(self):
|
|
ach_variables = {
|
|
'file_fullpath': 'DBT/VO-DBT-00001.mov',
|
|
'custom_data_in': {
|
|
'mediainfo': {
|
|
'media': {
|
|
'track': [
|
|
{'@type': 'General', 'Format': 'MPEG-4'},
|
|
{'@type': 'Video', 'Format': 'ProRes', 'Format_Profile': '4444'},
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
mime = get_mime_from_mediainfo(ach_variables)
|
|
self.assertEqual(mime, 'video/quicktime')
|
|
|
|
def test_master_not_prores_raises(self):
|
|
ach_variables = {
|
|
'file_fullpath': 'DBT/VO-DBT-00002.mov',
|
|
'custom_data_in': {
|
|
'mediainfo': {
|
|
'media': {
|
|
'track': [
|
|
{'@type': 'General', 'Format': 'MPEG-4'},
|
|
{'@type': 'Video', 'Format': 'AVC', 'Format_Profile': 'High'},
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
with self.assertRaises(ValueError):
|
|
get_mime_from_mediainfo(ach_variables)
|
|
|
|
def test_file_folder_allows_non_prores(self):
|
|
ach_variables = {
|
|
'file_fullpath': 'FILE/VO-DBT-00003.mp4',
|
|
'custom_data_in': {
|
|
'mediainfo': {
|
|
'media': {
|
|
'track': [
|
|
{'@type': 'General', 'Format': 'MPEG-4'},
|
|
{'@type': 'Video', 'Format': 'AVC', 'Format_Profile': 'High'},
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
mime = get_mime_from_mediainfo(ach_variables)
|
|
self.assertEqual(mime, 'video/mp4')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|