From ac966b232b3eab52d610d8f2df4e3029fc1381ff Mon Sep 17 00:00:00 2001 From: vijeth-aradhya Date: Sun, 25 Jun 2017 18:47:04 +0530 Subject: [PATCH] Test accepted_files and accepted_resolutions --- mediagoblin/tests/test_submission.py | 11 ++++++++++- mediagoblin/tests/test_video.py | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 3f6cf739..fb670e7a 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -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) diff --git a/mediagoblin/tests/test_video.py b/mediagoblin/tests/test_video.py index 79244515..748c857f 100644 --- a/mediagoblin/tests/test_video.py +++ b/mediagoblin/tests/test_video.py @@ -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 -- 2.25.1