added documentation
This commit is contained in:
parent
7c25827096
commit
7ba48b17d1
1 changed files with 7 additions and 3 deletions
|
|
@ -1,14 +1,15 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from unittest.mock import patch, MagicMock
|
from unittest.mock import patch, MagicMock
|
||||||
from .tasks import convert_video_to_hls, delete_original_video, create_thumbnails
|
from .tasks import convert_video_to_hls, delete_original_video
|
||||||
from .signals import auto_delete_file_on_delete
|
|
||||||
from .models import Video
|
|
||||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||||
|
|
||||||
|
|
||||||
class VideoTasksTest(TestCase):
|
class VideoTasksTest(TestCase):
|
||||||
@patch('subprocess.run')
|
@patch('subprocess.run')
|
||||||
def test_convert_video_to_hls(self, mock_subprocess_run):
|
def test_convert_video_to_hls(self, mock_subprocess_run):
|
||||||
|
"""
|
||||||
|
Tests whether the HLS conversion script is called correctly and the correct parameters are passed.
|
||||||
|
"""
|
||||||
mock_subprocess_run.return_value = MagicMock()
|
mock_subprocess_run.return_value = MagicMock()
|
||||||
convert_video_to_hls('test/source.mp4', '1080', 1)
|
convert_video_to_hls('test/source.mp4', '1080', 1)
|
||||||
mock_subprocess_run.assert_called_once()
|
mock_subprocess_run.assert_called_once()
|
||||||
|
|
@ -17,5 +18,8 @@ class VideoTasksTest(TestCase):
|
||||||
|
|
||||||
@patch('os.remove')
|
@patch('os.remove')
|
||||||
def test_delete_original_video(self, mock_os_remove):
|
def test_delete_original_video(self, mock_os_remove):
|
||||||
|
"""
|
||||||
|
Checks whether the original video file is successfully deleted after conversion.
|
||||||
|
"""
|
||||||
delete_original_video('test/source.mp4')
|
delete_original_video('test/source.mp4')
|
||||||
mock_os_remove.assert_called_once_with('test/source.mp4')
|
mock_os_remove.assert_called_once_with('test/source.mp4')
|
||||||
Loading…
Reference in a new issue