Merge pull request #32099 from open-craft/navin/fix-video-transcripts

This commit is contained in:
Edward Zarecor
2023-05-18 14:29:34 -04:00
committed by GitHub
4 changed files with 9 additions and 2 deletions

View File

@@ -256,6 +256,7 @@ class TestUploadTranscripts(BaseTranscripts):
expected_edx_video_id = edx_video_id if edx_video_id else json_response['edx_video_id']
video = modulestore().get_item(self.video_usage_key)
self.assertEqual(video.edx_video_id, expected_edx_video_id)
self.assertDictEqual(video.transcripts, {'en': f'{expected_edx_video_id}-en.srt'})
# Verify transcript content
actual_transcript = get_video_transcript_content(video.edx_video_id, language_code='en')
@@ -319,6 +320,8 @@ class TestUploadTranscripts(BaseTranscripts):
expected_status_code=400,
expected_message='There is a problem with this transcript file. Try to upload a different file.'
)
video = modulestore().get_item(self.video_usage_key)
self.assertDictEqual(video.transcripts, {})
def test_transcript_upload_unknown_category(self):
"""

View File

@@ -231,6 +231,8 @@ def upload_transcripts(request):
file_data=ContentFile(sjson_subs),
)
video.transcripts['en'] = f"{edx_video_id}-en.srt"
video.save_with_metadata(request.user)
if transcript_created is None:
response = JsonResponse({'status': 'Invalid Video ID'}, status=400)