-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(back) cleanup transcoding temp files
Once a video transcoded we want to delete the first transcoded video that is using a temporary file. Also a management command cleaning old temporary transcoded video is added
- Loading branch information
1 parent
c4ba0df
commit d27457e
Showing
5 changed files
with
121 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/backend/marsha/core/management/commands/delete_transcoding_temp_files.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Management command to delete transcoding temp files.""" | ||
|
||
import logging | ||
|
||
from django.core.management import BaseCommand | ||
|
||
from marsha.core.utils.transcode import delete_transcoding_temp_files | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Delete transcoding temp files.""" | ||
|
||
help = "Delete transcoding temp files" | ||
|
||
def handle(self, *args, **options): | ||
"""Delete all transcoding temp files.""" | ||
delete_transcoding_temp_files() |
23 changes: 23 additions & 0 deletions
23
src/backend/marsha/core/tests/management_commands/test_delete_transcoding_temp_files.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Test transcript_video command.""" | ||
|
||
from unittest.mock import patch | ||
|
||
from django.core.management import call_command | ||
from django.test import TestCase | ||
|
||
from marsha.core.utils import transcode | ||
|
||
|
||
@patch.object(transcode, "delete_transcoding_temp_files") | ||
class TranscriptVideosTestCase(TestCase): | ||
""" | ||
Test case for the transcript_videos command. | ||
""" | ||
|
||
maxDiff = None | ||
|
||
def test_delete_transcoding_temp_files(self, mock_delete_temp_files): | ||
"""Should call delete_transcoding_temp_files function.""" | ||
call_command("delete_transcoding_temp_files") | ||
|
||
mock_delete_temp_files.assert_called_once() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters