Test accepted_files and accepted_resolutions
authorvijeth-aradhya <vijthaaa@gmail.com>
Sun, 25 Jun 2017 13:17:04 +0000 (18:47 +0530)
committervijeth-aradhya <vijthaaa@gmail.com>
Sun, 25 Jun 2017 13:17:04 +0000 (18:47 +0530)
mediagoblin/tests/test_submission.py
mediagoblin/tests/test_video.py

index 3f6cf739cdff23d10c640a171a0a1e8a3ad92577..fb670e7ae0fbba1de97c58e1148caaca9bc71793 100644 (file)
@@ -61,7 +61,8 @@ from mediagoblin.tools import template
 from mediagoblin.media_types.image import ImageMediaManager
 from mediagoblin.media_types.pdf.processing import check_prerequisites as pdf_check_prerequisites
 from mediagoblin.media_types.video.processing import (
-    VideoProcessingManager, main_task, complimentary_task, group, processing_cleanup)
+    VideoProcessingManager, main_task, complimentary_task, group,
+    processing_cleanup, CommonVideoProcessor)
 from mediagoblin.media_types.video.util import ACCEPTED_RESOLUTIONS
 from mediagoblin.submit.lib import new_upload_entry, run_process_media
 
@@ -670,6 +671,14 @@ class TestSubmissionVideo(BaseTestSubmission):
         mock_chord.assert_called_once_with(transcoding_tasks)
         entry.delete()
 
+    def test_accepted_files(self):
+        entry = get_sample_entry(self.our_user(), 'mediagoblin.media_types.video')
+        manager = VideoProcessingManager()
+        processor = CommonVideoProcessor(manager, entry)
+        acceptable_files = ['original, best_quality', 'webm_144p', 'webm_360p',
+                            'webm_480p', 'webm_720p', 'webm_1080p', 'webm_video'] 
+        assert processor.acceptable_files == acceptable_files
+
 
 class TestSubmissionAudio(BaseTestSubmission):
     @pytest.fixture(autouse=True)
index 79244515b84dca3316fe0c858aae490e779b6f5b..748c857f835e1acb3e8637f2733d1af86135772f 100644 (file)
@@ -30,6 +30,7 @@ Gst.init(None)
 
 from mediagoblin.media_types.video.transcoders import (capture_thumb,
         VideoTranscoder)
+from mediagoblin.media_types.video.util import ACCEPTED_RESOLUTIONS
 from mediagoblin.media_types.tools import discover
 
 @contextmanager
@@ -130,3 +131,14 @@ def test_transcoder():
                 dimensions=(640, 640))
         assert len(discover(result_name).get_video_streams()) == 1
         assert len(discover(result_name).get_audio_streams()) == 1
+
+def test_accepted_resolutions():
+    accepted_resolutions = {
+        '144p' : (256, 144),
+        '240p' : (352, 240),
+        '360p' : (480, 360),
+        '480p' : (858, 480),
+        '720p' : (1280, 720),
+        '1080p' : (1920, 1080),
+    }
+    assert accepted_resolutions == ACCEPTED_RESOLUTIONS