remove video transcript enabled flag

This commit is contained in:
muhammad-ammar
2018-04-11 18:59:00 +05:00
parent 1ba833f3f7
commit aaaafee2b2
22 changed files with 87 additions and 258 deletions

View File

@@ -5,6 +5,7 @@ from io import BytesIO
from mock import Mock, patch, ANY from mock import Mock, patch, ANY
from django.test.testcases import TestCase from django.test.testcases import TestCase
from django.core.urlresolvers import reverse
from edxval import api from edxval import api
from contentstore.tests.utils import CourseTestCase from contentstore.tests.utils import CourseTestCase
@@ -177,26 +178,24 @@ class TranscriptCredentialsValidationTest(TestCase):
@ddt.ddt @ddt.ddt
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=True)
)
class TranscriptDownloadTest(CourseTestCase): class TranscriptDownloadTest(CourseTestCase):
""" """
Tests for transcript download handler. Tests for transcript download handler.
""" """
VIEW_NAME = 'transcript_download_handler'
def get_url_for_course_key(self, course_id): @property
return reverse_course_url(self.VIEW_NAME, course_id) def view_url(self):
"""
Returns url for this view
"""
return reverse('transcript_download_handler')
def test_302_with_anonymous_user(self): def test_302_with_anonymous_user(self):
""" """
Verify that redirection happens in case of unauthorized request. Verify that redirection happens in case of unauthorized request.
""" """
self.client.logout() self.client.logout()
transcript_download_url = self.get_url_for_course_key(self.course.id) response = self.client.get(self.view_url, content_type='application/json')
response = self.client.get(transcript_download_url, content_type='application/json')
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
def test_405_with_not_allowed_request_method(self): def test_405_with_not_allowed_request_method(self):
@@ -204,26 +203,14 @@ class TranscriptDownloadTest(CourseTestCase):
Verify that 405 is returned in case of not-allowed request methods. Verify that 405 is returned in case of not-allowed request methods.
Allowed request methods include GET. Allowed request methods include GET.
""" """
transcript_download_url = self.get_url_for_course_key(self.course.id) response = self.client.post(self.view_url, content_type='application/json')
response = self.client.post(transcript_download_url, content_type='application/json')
self.assertEqual(response.status_code, 405) self.assertEqual(response.status_code, 405)
def test_404_with_feature_disabled(self):
"""
Verify that 404 is returned if the corresponding feature is disabled.
"""
transcript_download_url = self.get_url_for_course_key(self.course.id)
with patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') as feature:
feature.return_value = False
response = self.client.get(transcript_download_url, content_type='application/json')
self.assertEqual(response.status_code, 404)
@patch('contentstore.views.transcript_settings.get_video_transcript_data') @patch('contentstore.views.transcript_settings.get_video_transcript_data')
def test_transcript_download_handler(self, mock_get_video_transcript_data): def test_transcript_download_handler(self, mock_get_video_transcript_data):
""" """
Tests that transcript download handler works as expected. Tests that transcript download handler works as expected.
""" """
transcript_download_url = self.get_url_for_course_key(self.course.id)
mock_get_video_transcript_data.return_value = { mock_get_video_transcript_data.return_value = {
'content': json.dumps({ 'content': json.dumps({
"start": [10], "start": [10],
@@ -235,7 +222,7 @@ class TranscriptDownloadTest(CourseTestCase):
# Make request to transcript download handler # Make request to transcript download handler
response = self.client.get( response = self.client.get(
transcript_download_url, self.view_url,
data={ data={
'edx_video_id': '123', 'edx_video_id': '123',
'language_code': 'en' 'language_code': 'en'
@@ -277,34 +264,30 @@ class TranscriptDownloadTest(CourseTestCase):
Tests that transcript download handler with missing attributes. Tests that transcript download handler with missing attributes.
""" """
# Make request to transcript download handler # Make request to transcript download handler
transcript_download_url = self.get_url_for_course_key(self.course.id) response = self.client.get(self.view_url, data=request_payload)
response = self.client.get(transcript_download_url, data=request_payload)
# Assert the response # Assert the response
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
self.assertEqual(json.loads(response.content)['error'], expected_error_message) self.assertEqual(json.loads(response.content)['error'], expected_error_message)
@ddt.ddt @ddt.ddt
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=True)
)
class TranscriptUploadTest(CourseTestCase): class TranscriptUploadTest(CourseTestCase):
""" """
Tests for transcript upload handler. Tests for transcript upload handler.
""" """
VIEW_NAME = 'transcript_upload_handler' @property
def view_url(self):
def get_url_for_course_key(self, course_id): """
return reverse_course_url(self.VIEW_NAME, course_id) Returns url for this view
"""
return reverse('transcript_upload_handler')
def test_302_with_anonymous_user(self): def test_302_with_anonymous_user(self):
""" """
Verify that redirection happens in case of unauthorized request. Verify that redirection happens in case of unauthorized request.
""" """
self.client.logout() self.client.logout()
transcript_upload_url = self.get_url_for_course_key(self.course.id) response = self.client.post(self.view_url, content_type='application/json')
response = self.client.post(transcript_upload_url, content_type='application/json')
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
def test_405_with_not_allowed_request_method(self): def test_405_with_not_allowed_request_method(self):
@@ -312,31 +295,19 @@ class TranscriptUploadTest(CourseTestCase):
Verify that 405 is returned in case of not-allowed request methods. Verify that 405 is returned in case of not-allowed request methods.
Allowed request methods include POST. Allowed request methods include POST.
""" """
transcript_upload_url = self.get_url_for_course_key(self.course.id) response = self.client.get(self.view_url, content_type='application/json')
response = self.client.get(transcript_upload_url, content_type='application/json')
self.assertEqual(response.status_code, 405) self.assertEqual(response.status_code, 405)
def test_404_with_feature_disabled(self):
"""
Verify that 404 is returned if the corresponding feature is disabled.
"""
transcript_upload_url = self.get_url_for_course_key(self.course.id)
with patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') as feature:
feature.return_value = False
response = self.client.post(transcript_upload_url, content_type='application/json')
self.assertEqual(response.status_code, 404)
@patch('contentstore.views.transcript_settings.create_or_update_video_transcript') @patch('contentstore.views.transcript_settings.create_or_update_video_transcript')
@patch('contentstore.views.transcript_settings.get_available_transcript_languages', Mock(return_value=['en'])) @patch('contentstore.views.transcript_settings.get_available_transcript_languages', Mock(return_value=['en']))
def test_transcript_upload_handler(self, mock_create_or_update_video_transcript): def test_transcript_upload_handler(self, mock_create_or_update_video_transcript):
""" """
Tests that transcript upload handler works as expected. Tests that transcript upload handler works as expected.
""" """
transcript_upload_url = self.get_url_for_course_key(self.course.id)
transcript_file_stream = BytesIO('0\n00:00:00,010 --> 00:00:00,100\nПривіт, edX вітає вас.\n\n') transcript_file_stream = BytesIO('0\n00:00:00,010 --> 00:00:00,100\nПривіт, edX вітає вас.\n\n')
# Make request to transcript upload handler # Make request to transcript upload handler
response = self.client.post( response = self.client.post(
transcript_upload_url, self.view_url,
{ {
'edx_video_id': '123', 'edx_video_id': '123',
'language_code': 'en', 'language_code': 'en',
@@ -395,9 +366,8 @@ class TranscriptUploadTest(CourseTestCase):
""" """
Tests the transcript upload handler when the required attributes are missing. Tests the transcript upload handler when the required attributes are missing.
""" """
transcript_upload_url = self.get_url_for_course_key(self.course.id)
# Make request to transcript upload handler # Make request to transcript upload handler
response = self.client.post(transcript_upload_url, request_payload, format='multipart') response = self.client.post(self.view_url, request_payload, format='multipart')
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
self.assertEqual(json.loads(response.content)['error'], expected_error_message) self.assertEqual(json.loads(response.content)['error'], expected_error_message)
@@ -407,14 +377,13 @@ class TranscriptUploadTest(CourseTestCase):
Tests that upload handler do not update transcript's language if a transcript Tests that upload handler do not update transcript's language if a transcript
with the same language already present for an edx_video_id. with the same language already present for an edx_video_id.
""" """
transcript_upload_url = self.get_url_for_course_key(self.course.id)
# Make request to transcript upload handler # Make request to transcript upload handler
request_payload = { request_payload = {
'edx_video_id': '1234', 'edx_video_id': '1234',
'language_code': 'en', 'language_code': 'en',
'new_language_code': 'es' 'new_language_code': 'es'
} }
response = self.client.post(transcript_upload_url, request_payload, format='multipart') response = self.client.post(self.view_url, request_payload, format='multipart')
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
self.assertEqual( self.assertEqual(
json.loads(response.content)['error'], json.loads(response.content)['error'],
@@ -427,10 +396,9 @@ class TranscriptUploadTest(CourseTestCase):
Tests the transcript upload handler with an image file. Tests the transcript upload handler with an image file.
""" """
with make_image_file() as image_file: with make_image_file() as image_file:
transcript_upload_url = self.get_url_for_course_key(self.course.id)
# Make request to transcript upload handler # Make request to transcript upload handler
response = self.client.post( response = self.client.post(
transcript_upload_url, self.view_url,
{ {
'edx_video_id': '123', 'edx_video_id': '123',
'language_code': 'en', 'language_code': 'en',
@@ -451,11 +419,10 @@ class TranscriptUploadTest(CourseTestCase):
""" """
Tests the transcript upload handler with an invalid transcript file. Tests the transcript upload handler with an invalid transcript file.
""" """
transcript_upload_url = self.get_url_for_course_key(self.course.id)
transcript_file_stream = BytesIO('An invalid transcript SubRip file content') transcript_file_stream = BytesIO('An invalid transcript SubRip file content')
# Make request to transcript upload handler # Make request to transcript upload handler
response = self.client.post( response = self.client.post(
transcript_upload_url, self.view_url,
{ {
'edx_video_id': '123', 'edx_video_id': '123',
'language_code': 'en', 'language_code': 'en',
@@ -473,11 +440,7 @@ class TranscriptUploadTest(CourseTestCase):
@ddt.ddt @ddt.ddt
@patch( class TranscriptDeleteTest(CourseTestCase):
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=True)
)
class TranscriptUploadTest(CourseTestCase):
""" """
Tests for transcript deletion handler. Tests for transcript deletion handler.
""" """
@@ -504,16 +467,6 @@ class TranscriptUploadTest(CourseTestCase):
response = self.client.post(transcript_delete_url) response = self.client.post(transcript_delete_url)
self.assertEqual(response.status_code, 405) self.assertEqual(response.status_code, 405)
def test_404_with_feature_disabled(self):
"""
Verify that 404 is returned if the corresponding feature is disabled.
"""
transcript_delete_url = self.get_url_for_course_key(self.course.id, edx_video_id='test_id', language_code='en')
with patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') as feature:
feature.return_value = False
response = self.client.delete(transcript_delete_url)
self.assertEqual(response.status_code, 404)
def test_404_with_non_staff_user(self): def test_404_with_non_staff_user(self):
""" """
Verify that 404 is returned if the user doesn't have studio write access. Verify that 404 is returned if the user doesn't have studio write access.

View File

@@ -224,7 +224,15 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
original_video = self.previous_uploads[-(i + 1)] original_video = self.previous_uploads[-(i + 1)]
self.assertEqual( self.assertEqual(
set(response_video.keys()), set(response_video.keys()),
set(['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url']) set([
'edx_video_id',
'client_video_id',
'created',
'duration',
'status',
'course_video_image_url',
'transcripts'
])
) )
dateutil.parser.parse(response_video['created']) dateutil.parser.parse(response_video['created'])
for field in ['edx_video_id', 'client_video_id', 'duration']: for field in ['edx_video_id', 'client_video_id', 'duration']:
@@ -236,13 +244,6 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
@ddt.data( @ddt.data(
( (
False,
['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url'],
[],
[]
),
(
True,
['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url', ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url',
'transcripts'], 'transcripts'],
[ [
@@ -257,7 +258,6 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
['en'] ['en']
), ),
( (
True,
['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url', ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'course_video_image_url',
'transcripts'], 'transcripts'],
[ [
@@ -280,14 +280,10 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
) )
) )
@ddt.unpack @ddt.unpack
@patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled') def test_get_json_transcripts(self, expected_video_keys, uploaded_transcripts, expected_transcripts):
def test_get_json_transcripts(self, is_video_transcript_enabled, expected_video_keys, uploaded_transcripts,
expected_transcripts, video_transcript_feature):
""" """
Test that transcripts are attached based on whether the video transcript feature is enabled. Test that transcripts are attached based on whether the video transcript feature is enabled.
""" """
video_transcript_feature.return_value = is_video_transcript_enabled
for transcript in uploaded_transcripts: for transcript in uploaded_transcripts:
create_or_update_video_transcript( create_or_update_video_transcript(
transcript['video_id'], transcript['video_id'],

View File

@@ -130,23 +130,18 @@ def transcript_credentials_handler(request, course_key_string):
@login_required @login_required
@require_GET @require_GET
def transcript_download_handler(request, course_key_string): def transcript_download_handler(request):
""" """
JSON view handler to download a transcript. JSON view handler to download a transcript.
Arguments: Arguments:
request: WSGI request object request: WSGI request object
course_key_string: course key
Returns: Returns:
- A 200 response with SRT transcript file attached. - A 200 response with SRT transcript file attached.
- A 400 if there is a validation error. - A 400 if there is a validation error.
- A 404 if there is no such transcript or feature flag is disabled. - A 404 if there is no such transcript.
""" """
course_key = CourseKey.from_string(course_key_string)
if not VideoTranscriptEnabledFlag.feature_enabled(course_key):
return HttpResponseNotFound()
missing = [attr for attr in ['edx_video_id', 'language_code'] if attr not in request.GET] missing = [attr for attr in ['edx_video_id', 'language_code'] if attr not in request.GET]
if missing: if missing:
return JsonResponse( return JsonResponse(
@@ -206,27 +201,20 @@ def validate_transcript_upload_data(data, files):
@login_required @login_required
@require_POST @require_POST
def transcript_upload_handler(request, course_key_string): def transcript_upload_handler(request):
""" """
View to upload a transcript file. View to upload a transcript file.
Arguments: Arguments:
request: A WSGI request object request: A WSGI request object
course_key_string: Course key identifying a course
Transcript file, edx video id and transcript language are required. Transcript file, edx video id and transcript language are required.
Transcript file should be in SRT(SubRip) format. Transcript file should be in SRT(SubRip) format.
Returns Returns
- A 400 if any of the validation fails - A 400 if any of the validation fails
- A 404 if the corresponding feature flag is disabled
- A 200 if transcript has been uploaded successfully - A 200 if transcript has been uploaded successfully
""" """
# Check whether the feature is available for this course.
course_key = CourseKey.from_string(course_key_string)
if not VideoTranscriptEnabledFlag.feature_enabled(course_key):
return HttpResponseNotFound()
error = validate_transcript_upload_data(data=request.POST, files=request.FILES) error = validate_transcript_upload_data(data=request.POST, files=request.FILES)
if error: if error:
response = JsonResponse({'error': error}, status=400) response = JsonResponse({'error': error}, status=400)
@@ -276,14 +264,13 @@ def transcript_delete_handler(request, course_key_string, edx_video_id, language
language_code: transcript's language code. language_code: transcript's language code.
Returns Returns
- A 404 if the corresponding feature flag is disabled or user does not have required permisions - A 404 if the user does not have required permisions
- A 200 if transcript is deleted without any error(s) - A 200 if transcript is deleted without any error(s)
""" """
# Check whether the feature is available for this course. # Check whether the feature is available for this course.
course_key = CourseKey.from_string(course_key_string) course_key = CourseKey.from_string(course_key_string)
video_transcripts_enabled = VideoTranscriptEnabledFlag.feature_enabled(course_key)
# User needs to have studio write access for this course. # User needs to have studio write access for this course.
if not video_transcripts_enabled or not has_studio_write_access(request.user, course_key): if not has_studio_write_access(request.user, course_key):
return HttpResponseNotFound() return HttpResponseNotFound()
delete_video_transcript(video_id=edx_video_id, language_code=language_code) delete_video_transcript(video_id=edx_video_id, language_code=language_code)

View File

@@ -45,9 +45,6 @@ from xmodule.video_module.transcripts_utils import (
get_transcript, get_transcript,
get_transcript_from_val, get_transcript_from_val,
) )
from xmodule.video_module.transcripts_model_utils import (
is_val_transcript_feature_enabled_for_course
)
from cms.djangoapps.contentstore.views.videos import TranscriptProvider from cms.djangoapps.contentstore.views.videos import TranscriptProvider

View File

@@ -15,6 +15,7 @@ from django.conf import settings
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.files.images import get_image_dimensions from django.core.files.images import get_image_dimensions
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseNotFound from django.http import HttpResponse, HttpResponseNotFound
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_noop from django.utils.translation import ugettext_noop
@@ -533,15 +534,12 @@ def _get_videos(course):
""" """
Retrieves the list of videos from VAL corresponding to this course. Retrieves the list of videos from VAL corresponding to this course.
""" """
is_video_transcript_enabled = VideoTranscriptEnabledFlag.feature_enabled(course.id)
videos = list(get_videos_for_course(unicode(course.id), VideoSortField.created, SortDirection.desc)) videos = list(get_videos_for_course(unicode(course.id), VideoSortField.created, SortDirection.desc))
# convert VAL's status to studio's Video Upload feature status. # convert VAL's status to studio's Video Upload feature status.
for video in videos: for video in videos:
video["status"] = convert_video_status(video) video["status"] = convert_video_status(video)
video['transcripts'] = get_available_transcript_languages(video_id=video['edx_video_id'])
if is_video_transcript_enabled:
video['transcripts'] = get_available_transcript_languages(video_id=video['edx_video_id'])
return videos return videos
@@ -558,10 +556,7 @@ def _get_index_videos(course):
Returns the information about each video upload required for the video list Returns the information about each video upload required for the video list
""" """
course_id = unicode(course.id) course_id = unicode(course.id)
attrs = ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'courses'] attrs = ['edx_video_id', 'client_video_id', 'created', 'duration', 'status', 'courses', 'transcripts']
if VideoTranscriptEnabledFlag.feature_enabled(course.id):
attrs += ['transcripts']
def _get_values(video): def _get_values(video):
""" """
@@ -631,14 +626,19 @@ def videos_index_html(course):
'supported_file_formats': settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS 'supported_file_formats': settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS
}, },
'is_video_transcript_enabled': is_video_transcript_enabled, 'is_video_transcript_enabled': is_video_transcript_enabled,
'video_transcript_settings': None,
'active_transcript_preferences': None, 'active_transcript_preferences': None,
'transcript_credentials': None, 'transcript_credentials': None,
'transcript_available_languages': None 'transcript_available_languages': get_all_transcript_languages(),
'video_transcript_settings': {
'transcript_download_handler_url': reverse('transcript_download_handler'),
'transcript_upload_handler_url': reverse('transcript_upload_handler'),
'transcript_delete_handler_url': reverse_course_url('transcript_delete_handler', unicode(course.id)),
'trancript_download_file_format': Transcript.SRT
}
} }
if is_video_transcript_enabled: if is_video_transcript_enabled:
context['video_transcript_settings'] = { context['video_transcript_settings'].update({
'transcript_preferences_handler_url': reverse_course_url( 'transcript_preferences_handler_url': reverse_course_url(
'transcript_preferences_handler', 'transcript_preferences_handler',
unicode(course.id) unicode(course.id)
@@ -647,25 +647,11 @@ def videos_index_html(course):
'transcript_credentials_handler', 'transcript_credentials_handler',
unicode(course.id) unicode(course.id)
), ),
'transcript_download_handler_url': reverse_course_url(
'transcript_download_handler',
unicode(course.id)
),
'transcript_upload_handler_url': reverse_course_url(
'transcript_upload_handler',
unicode(course.id)
),
'transcript_delete_handler_url': reverse_course_url(
'transcript_delete_handler',
unicode(course.id)
),
'transcription_plans': get_3rd_party_transcription_plans(), 'transcription_plans': get_3rd_party_transcription_plans(),
'trancript_download_file_format': Transcript.SRT })
}
context['active_transcript_preferences'] = get_transcript_preferences(unicode(course.id)) context['active_transcript_preferences'] = get_transcript_preferences(unicode(course.id))
# Cached state for transcript providers' credentials (org-specific) # Cached state for transcript providers' credentials (org-specific)
context['transcript_credentials'] = get_transcript_credentials_state_for_org(course.id.org) context['transcript_credentials'] = get_transcript_credentials_state_for_org(course.id.org)
context['transcript_available_languages'] = get_all_transcript_languages()
return render_to_response('videos_index.html', context) return render_to_response('videos_index.html', context)

View File

@@ -55,8 +55,7 @@ define([
videoImageSettings: videoImageSettings, videoImageSettings: videoImageSettings,
videoTranscriptSettings: videoTranscriptSettings, videoTranscriptSettings: videoTranscriptSettings,
transcriptAvailableLanguages: transcriptAvailableLanguages, transcriptAvailableLanguages: transcriptAvailableLanguages,
videoSupportedFileFormats: videoSupportedFileFormats, videoSupportedFileFormats: videoSupportedFileFormats
isVideoTranscriptEnabled: isVideoTranscriptEnabled
}); });
$contentWrapper.find('.wrapper-assets').replaceWith(updatedView.render().$el); $contentWrapper.find('.wrapper-assets').replaceWith(updatedView.render().$el);
}); });
@@ -71,8 +70,7 @@ define([
videoImageSettings: videoImageSettings, videoImageSettings: videoImageSettings,
videoTranscriptSettings: videoTranscriptSettings, videoTranscriptSettings: videoTranscriptSettings,
transcriptAvailableLanguages: transcriptAvailableLanguages, transcriptAvailableLanguages: transcriptAvailableLanguages,
videoSupportedFileFormats: videoSupportedFileFormats, videoSupportedFileFormats: videoSupportedFileFormats
isVideoTranscriptEnabled: isVideoTranscriptEnabled
}); });
$contentWrapper.append(activeView.render().$el); $contentWrapper.append(activeView.render().$el);
$contentWrapper.append(previousView.render().$el); $contentWrapper.append(previousView.render().$el);

View File

@@ -11,7 +11,8 @@ define(
duration: 42, duration: 42,
created: '2014-11-25T23:13:05', created: '2014-11-25T23:13:05',
edx_video_id: 'dummy_id', edx_video_id: 'dummy_id',
status: 'uploading' status: 'uploading',
transcripts: []
}; };
var collection = new Backbone.Collection( var collection = new Backbone.Collection(
_.map( _.map(
@@ -26,6 +27,9 @@ define(
var view = new PreviousVideoUploadListView({ var view = new PreviousVideoUploadListView({
collection: collection, collection: collection,
videoHandlerUrl: videoHandlerUrl, videoHandlerUrl: videoHandlerUrl,
transcriptAvailableLanguages: [],
videoSupportedFileFormats: [],
videoTranscriptSettings: {},
videoImageSettings: {} videoImageSettings: {}
}); });
return view.render().$el; return view.render().$el;

View File

@@ -10,11 +10,15 @@ define(
duration: 42, duration: 42,
created: '2014-11-25T23:13:05', created: '2014-11-25T23:13:05',
edx_video_id: 'dummy_id', edx_video_id: 'dummy_id',
status: 'uploading' status: 'uploading',
transcripts: []
}, },
view = new PreviousVideoUploadView({ view = new PreviousVideoUploadView({
model: new Backbone.Model($.extend({}, defaultData, modelData)), model: new Backbone.Model($.extend({}, defaultData, modelData)),
videoHandlerUrl: '/videos/course-v1:org.0+course_0+Run_0', videoHandlerUrl: '/videos/course-v1:org.0+course_0+Run_0',
transcriptAvailableLanguages: [],
videoSupportedFileFormats: [],
videoTranscriptSettings: {},
videoImageSettings: {} videoImageSettings: {}
}); });
return view.render().$el; return view.render().$el;

View File

@@ -43,7 +43,8 @@ define(
duration: 42, duration: 42,
created: '2014-11-25T23:13:05', created: '2014-11-25T23:13:05',
edx_video_id: 'dummy_id', edx_video_id: 'dummy_id',
status: 'uploading' status: 'uploading',
transcripts: []
}, },
collection = new Backbone.Collection(_.map(_.range(numVideos), function(num, index) { collection = new Backbone.Collection(_.map(_.range(numVideos), function(num, index) {
return new Backbone.Model( return new Backbone.Model(
@@ -61,7 +62,10 @@ define(
max_height: VIDEO_IMAGE_MAX_HEIGHT, max_height: VIDEO_IMAGE_MAX_HEIGHT,
supported_file_formats: VIDEO_IMAGE_SUPPORTED_FILE_FORMATS, supported_file_formats: VIDEO_IMAGE_SUPPORTED_FILE_FORMATS,
video_image_upload_enabled: videoImageUploadEnabled video_image_upload_enabled: videoImageUploadEnabled
} },
transcriptAvailableLanguages: [],
videoSupportedFileFormats: [],
videoTranscriptSettings: {}
}); });
$videoListEl = videoListView.render().$el; $videoListEl = videoListView.render().$el;

View File

@@ -93,9 +93,8 @@ define(
return new File([new Blob([Array(size).join('i')], {type: type})], transcriptFileName); return new File([new Blob([Array(size).join('i')], {type: type})], transcriptFileName);
}; };
renderView = function(availableTranscripts, isVideoTranscriptEnabled) { renderView = function(availableTranscripts) {
var videoViewIndex = 0, var videoViewIndex = 0,
isVideoTranscriptEnabled = isVideoTranscriptEnabled || _.isUndefined(isVideoTranscriptEnabled), // eslint-disable-line max-len, no-redeclare
videoData = { videoData = {
client_video_id: clientVideoID, client_video_id: clientVideoID,
edx_video_id: edxVideoID, edx_video_id: edxVideoID,
@@ -109,8 +108,7 @@ define(
videoImageSettings: {}, videoImageSettings: {},
videoTranscriptSettings: videoTranscriptSettings, videoTranscriptSettings: videoTranscriptSettings,
transcriptAvailableLanguages: transcriptAvailableLanguages, transcriptAvailableLanguages: transcriptAvailableLanguages,
videoSupportedFileFormats: videoSupportedFileFormats, videoSupportedFileFormats: videoSupportedFileFormats
isVideoTranscriptEnabled: isVideoTranscriptEnabled
}); });
videoListView.setElement($('.wrapper-assets')); videoListView.setElement($('.wrapper-assets'));
videoListView.render(); videoListView.render();
@@ -139,18 +137,6 @@ define(
expect(_.isUndefined(videoTranscriptsView)).toEqual(false); expect(_.isUndefined(videoTranscriptsView)).toEqual(false);
}); });
it('does not render transcripts view if feature is disabled', function() {
renderView(transcripts, false);
// Verify transcript container is not present.
expect(videoListView.$el.find('.video-transcripts-header')).not.toExist();
// Veirfy transcript column header is not present.
expect(videoListView.$el.find('.js-table-head .video-head-col.transcripts-col')).not.toExist();
// Verify transcript data column is not present.
expect(videoListView.$el.find('.js-table-body .transcripts-col')).not.toExist();
// Verify view has not initiallized.
expect(_.isUndefined(videoTranscriptsView)).toEqual(true);
});
it('does not show list of transcripts initially', function() { it('does not show list of transcripts initially', function() {
expect( expect(
videoTranscriptsView.$el.find('.video-transcripts-wrapper').hasClass('hidden') videoTranscriptsView.$el.find('.video-transcripts-wrapper').hasClass('hidden')

View File

@@ -20,7 +20,6 @@ define(
this.template = HtmlUtils.template(previousVideoUploadTemplate); this.template = HtmlUtils.template(previousVideoUploadTemplate);
this.videoHandlerUrl = options.videoHandlerUrl; this.videoHandlerUrl = options.videoHandlerUrl;
this.videoImageUploadEnabled = options.videoImageSettings.video_image_upload_enabled; this.videoImageUploadEnabled = options.videoImageSettings.video_image_upload_enabled;
this.isVideoTranscriptEnabled = options.isVideoTranscriptEnabled;
if (this.videoImageUploadEnabled) { if (this.videoImageUploadEnabled) {
this.videoThumbnailView = new VideoThumbnailView({ this.videoThumbnailView = new VideoThumbnailView({
@@ -30,22 +29,19 @@ define(
videoImageSettings: options.videoImageSettings videoImageSettings: options.videoImageSettings
}); });
} }
if (this.isVideoTranscriptEnabled) { this.videoTranscriptsView = new VideoTranscriptsView({
this.videoTranscriptsView = new VideoTranscriptsView({ transcripts: this.model.get('transcripts'),
transcripts: this.model.get('transcripts'), edxVideoID: this.model.get('edx_video_id'),
edxVideoID: this.model.get('edx_video_id'), clientVideoID: this.model.get('client_video_id'),
clientVideoID: this.model.get('client_video_id'), transcriptAvailableLanguages: options.transcriptAvailableLanguages,
transcriptAvailableLanguages: options.transcriptAvailableLanguages, videoSupportedFileFormats: options.videoSupportedFileFormats,
videoSupportedFileFormats: options.videoSupportedFileFormats, videoTranscriptSettings: options.videoTranscriptSettings
videoTranscriptSettings: options.videoTranscriptSettings });
});
}
}, },
render: function() { render: function() {
var renderedAttributes = { var renderedAttributes = {
videoImageUploadEnabled: this.videoImageUploadEnabled, videoImageUploadEnabled: this.videoImageUploadEnabled,
isVideoTranscriptEnabled: this.isVideoTranscriptEnabled,
created: DateUtils.renderDate(this.model.get('created')), created: DateUtils.renderDate(this.model.get('created')),
status: this.model.get('status') status: this.model.get('status')
}; };
@@ -59,9 +55,7 @@ define(
if (this.videoImageUploadEnabled) { if (this.videoImageUploadEnabled) {
this.videoThumbnailView.setElement(this.$('.thumbnail-col')).render(); this.videoThumbnailView.setElement(this.$('.thumbnail-col')).render();
} }
if (this.isVideoTranscriptEnabled) { this.videoTranscriptsView.setElement(this.$('.transcripts-col')).render();
this.videoTranscriptsView.setElement(this.$('.transcripts-col')).render();
}
return this; return this;
}, },

View File

@@ -11,7 +11,6 @@ define(
this.template = HtmlUtils.template(previousVideoUploadListTemplate); this.template = HtmlUtils.template(previousVideoUploadListTemplate);
this.encodingsDownloadUrl = options.encodingsDownloadUrl; this.encodingsDownloadUrl = options.encodingsDownloadUrl;
this.videoImageUploadEnabled = options.videoImageSettings.video_image_upload_enabled; this.videoImageUploadEnabled = options.videoImageSettings.video_image_upload_enabled;
this.isVideoTranscriptEnabled = options.isVideoTranscriptEnabled;
this.itemViews = this.collection.map(function(model) { this.itemViews = this.collection.map(function(model) {
return new PreviousVideoUploadView({ return new PreviousVideoUploadView({
videoImageUploadURL: options.videoImageUploadURL, videoImageUploadURL: options.videoImageUploadURL,
@@ -21,8 +20,7 @@ define(
videoTranscriptSettings: options.videoTranscriptSettings, videoTranscriptSettings: options.videoTranscriptSettings,
model: model, model: model,
transcriptAvailableLanguages: options.transcriptAvailableLanguages, transcriptAvailableLanguages: options.transcriptAvailableLanguages,
videoSupportedFileFormats: options.videoSupportedFileFormats, videoSupportedFileFormats: options.videoSupportedFileFormats
isVideoTranscriptEnabled: options.isVideoTranscriptEnabled
}); });
}); });
}, },
@@ -35,8 +33,7 @@ define(
this.$el, this.$el,
this.template({ this.template({
encodingsDownloadUrl: this.encodingsDownloadUrl, encodingsDownloadUrl: this.encodingsDownloadUrl,
videoImageUploadEnabled: this.videoImageUploadEnabled, videoImageUploadEnabled: this.videoImageUploadEnabled
isVideoTranscriptEnabled: this.isVideoTranscriptEnabled
}) })
); );

View File

@@ -14,9 +14,7 @@
<div class="video-head-col video-col name-col"><%- gettext("Name") %></div> <div class="video-head-col video-col name-col"><%- gettext("Name") %></div>
<div class="video-head-col video-col date-col"><%- gettext("Date Added") %></div> <div class="video-head-col video-col date-col"><%- gettext("Date Added") %></div>
<div class="video-head-col video-col video-id-col"><%- gettext("Video ID") %></div> <div class="video-head-col video-col video-id-col"><%- gettext("Video ID") %></div>
<% if (isVideoTranscriptEnabled) { %>
<div class="video-head-col video-col transcripts-col"><%- gettext("Transcripts") %></div> <div class="video-head-col video-col transcripts-col"><%- gettext("Transcripts") %></div>
<% } %>
<div class="video-head-col video-col status-col"><%- gettext("Status") %></div> <div class="video-head-col video-col status-col"><%- gettext("Status") %></div>
<div class="video-head-col video-col actions-col"><%- gettext("Action") %></div> <div class="video-head-col video-col actions-col"><%- gettext("Action") %></div>
</div> </div>

View File

@@ -5,9 +5,7 @@
<div class="video-col name-col"><%- client_video_id %></div> <div class="video-col name-col"><%- client_video_id %></div>
<div class="video-col date-col"><%- created %></div> <div class="video-col date-col"><%- created %></div>
<div class="video-col video-id-col"><%- edx_video_id %></div> <div class="video-col video-id-col"><%- edx_video_id %></div>
<% if (isVideoTranscriptEnabled) { %>
<div class="video-col transcripts-col"></div> <div class="video-col transcripts-col"></div>
<% } %>
<div class="video-col status-col"><%- status %></div> <div class="video-col status-col"><%- status %></div>
<div class="video-col actions-col"> <div class="video-col actions-col">
<ul class="actions-list"> <ul class="actions-list">

View File

@@ -139,10 +139,8 @@ urlpatterns = [
contentstore.views.transcript_preferences_handler, name='transcript_preferences_handler'), contentstore.views.transcript_preferences_handler, name='transcript_preferences_handler'),
url(r'^transcript_credentials/{}$'.format(settings.COURSE_KEY_PATTERN), url(r'^transcript_credentials/{}$'.format(settings.COURSE_KEY_PATTERN),
contentstore.views.transcript_credentials_handler, name='transcript_credentials_handler'), contentstore.views.transcript_credentials_handler, name='transcript_credentials_handler'),
url(r'^transcript_download/{}$'.format(settings.COURSE_KEY_PATTERN), url(r'^transcript_download/$', contentstore.views.transcript_download_handler, name='transcript_download_handler'),
contentstore.views.transcript_download_handler, name='transcript_download_handler'), url(r'^transcript_upload/$', contentstore.views.transcript_upload_handler, name='transcript_upload_handler'),
url(r'^transcript_upload/{}$'.format(settings.COURSE_KEY_PATTERN),
contentstore.views.transcript_upload_handler, name='transcript_upload_handler'),
url(r'^transcript_delete/{}(?:/(?P<edx_video_id>[-\w]+))?(?:/(?P<language_code>[^/]*))?$'.format( url(r'^transcript_delete/{}(?:/(?P<edx_video_id>[-\w]+))?(?:/(?P<language_code>[^/]*))?$'.format(
settings.COURSE_KEY_PATTERN settings.COURSE_KEY_PATTERN
), contentstore.views.transcript_delete_handler, name='transcript_delete_handler'), ), contentstore.views.transcript_delete_handler, name='transcript_delete_handler'),

View File

@@ -901,19 +901,16 @@ class VideoDescriptorStudentViewDataTestCase(unittest.TestCase):
), ),
) )
@ddt.unpack @ddt.unpack
@patch('xmodule.video_module.video_module.is_val_transcript_feature_enabled_for_course') def test_student_view_data(self, field_data, expected_student_view_data):
def test_student_view_data(self, field_data, expected_student_view_data, mock_transcript_feature):
""" """
Ensure that student_view_data returns the expected results for video modules. Ensure that student_view_data returns the expected results for video modules.
""" """
mock_transcript_feature.return_value = False
descriptor = instantiate_descriptor(**field_data) descriptor = instantiate_descriptor(**field_data)
descriptor.runtime.course_id = MagicMock() descriptor.runtime.course_id = MagicMock()
student_view_data = descriptor.student_view_data() student_view_data = descriptor.student_view_data()
self.assertEquals(student_view_data, expected_student_view_data) self.assertEquals(student_view_data, expected_student_view_data)
@patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True)) @patch('xmodule.video_module.video_module.HLSPlaybackEnabledFlag.feature_enabled', Mock(return_value=True))
@patch('xmodule.video_module.video_module.is_val_transcript_feature_enabled_for_course', Mock(return_value=False))
@patch('xmodule.video_module.transcripts_utils.get_available_transcript_languages', Mock(return_value=['es'])) @patch('xmodule.video_module.transcripts_utils.get_available_transcript_languages', Mock(return_value=['es']))
@patch('edxval.api.get_video_info_for_course_and_profiles', Mock(return_value={})) @patch('edxval.api.get_video_info_for_course_and_profiles', Mock(return_value={}))
@patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content')

View File

@@ -1,14 +0,0 @@
"""
Utility functions for transcripts dealing with Django models.
"""
from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag
def is_val_transcript_feature_enabled_for_course(course_id):
"""
Get edx-val transcript feature flag
Arguments:
course_id(CourseKey): Course key identifying a course whose feature flag is being inspected.
"""
return VideoTranscriptEnabledFlag.feature_enabled(course_id=course_id)

View File

@@ -51,9 +51,7 @@ from .transcripts_utils import (
subs_filename, subs_filename,
get_transcript_for_video get_transcript_for_video
) )
from .transcripts_model_utils import (
is_val_transcript_feature_enabled_for_course
)
from .video_handlers import VideoStudentViewHandlers, VideoStudioViewHandlers from .video_handlers import VideoStudentViewHandlers, VideoStudioViewHandlers
from .video_utils import create_youtube_string, format_xml_exception_message, get_poster, rewrite_video_url from .video_utils import create_youtube_string, format_xml_exception_message, get_poster, rewrite_video_url
from .video_xfields import VideoFields from .video_xfields import VideoFields

View File

@@ -276,7 +276,6 @@ class TestTranscriptAvailableTranslationsDispatch(TestVideo):
response = self.item.transcript(request=request, dispatch='available_translations') response = self.item.transcript(request=request, dispatch='available_translations')
self.assertEqual(json.loads(response.body), ['en', 'uk']) self.assertEqual(json.loads(response.body), ['en', 'uk'])
@patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', Mock(return_value=True))
@patch('xmodule.video_module.transcripts_utils.get_video_transcript_content') @patch('xmodule.video_module.transcripts_utils.get_video_transcript_content')
@patch('xmodule.video_module.transcripts_utils.get_available_transcript_languages') @patch('xmodule.video_module.transcripts_utils.get_available_transcript_languages')
@ddt.data( @ddt.data(
@@ -354,10 +353,6 @@ class TestTranscriptAvailableTranslationsDispatch(TestVideo):
response = self.item.transcript(request=request, dispatch='available_translations') response = self.item.transcript(request=request, dispatch='available_translations')
self.assertItemsEqual(json.loads(response.body), result) self.assertItemsEqual(json.loads(response.body), result)
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=False),
)
@patch('xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages') @patch('xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages')
def test_val_available_translations_feature_disabled(self, mock_get_available_transcript_languages): def test_val_available_translations_feature_disabled(self, mock_get_available_transcript_languages):
""" """
@@ -511,7 +506,6 @@ class TestTranscriptDownloadDispatch(TestVideo):
self.assertEqual(response.headers['Content-Disposition'], 'attachment; filename="en_塞.srt"') self.assertEqual(response.headers['Content-Disposition'], 'attachment; filename="en_塞.srt"')
@patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data') @patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data')
@patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', Mock(return_value=True))
@patch('xmodule.video_module.VideoModule.get_transcript', Mock(side_effect=NotFoundError)) @patch('xmodule.video_module.VideoModule.get_transcript', Mock(side_effect=NotFoundError))
def test_download_fallback_transcript(self, mock_get_video_transcript_data): def test_download_fallback_transcript(self, mock_get_video_transcript_data):
""" """
@@ -544,21 +538,6 @@ class TestTranscriptDownloadDispatch(TestVideo):
for attribute, value in expected_headers.iteritems(): for attribute, value in expected_headers.iteritems():
self.assertEqual(response.headers[attribute], value) self.assertEqual(response.headers[attribute], value)
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=False),
)
@patch('xmodule.video_module.VideoModule.get_transcript', Mock(side_effect=NotFoundError))
def test_download_fallback_transcript_feature_disabled(self):
"""
Verify val transcript if its feature is disabled.
"""
# Make request to XModule transcript handler
request = Request.blank('/download')
response = self.item.transcript(request=request, dispatch='download')
# Assert the actual response
self.assertEqual(response.status_code, 404)
@attr(shard=1) @attr(shard=1)
@ddt.ddt @ddt.ddt
@@ -798,7 +777,6 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
store.update_item(self.course, self.user.id) store.update_item(self.course, self.user.id)
@patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data') @patch('xmodule.video_module.transcripts_utils.edxval_api.get_video_transcript_data')
@patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', Mock(return_value=True))
@patch('xmodule.video_module.VideoModule.translation', Mock(side_effect=NotFoundError)) @patch('xmodule.video_module.VideoModule.translation', Mock(side_effect=NotFoundError))
@patch('xmodule.video_module.VideoModule.get_static_transcript', Mock(return_value=Response(status=404))) @patch('xmodule.video_module.VideoModule.get_static_transcript', Mock(return_value=Response(status=404)))
def test_translation_fallback_transcript(self, mock_get_video_transcript_data): def test_translation_fallback_transcript(self, mock_get_video_transcript_data):
@@ -831,10 +809,6 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
for attribute, value in expected_headers.iteritems(): for attribute, value in expected_headers.iteritems():
self.assertEqual(response.headers[attribute], value) self.assertEqual(response.headers[attribute], value)
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=False),
)
@patch('xmodule.video_module.VideoModule.translation', Mock(side_effect=NotFoundError)) @patch('xmodule.video_module.VideoModule.translation', Mock(side_effect=NotFoundError))
@patch('xmodule.video_module.VideoModule.get_static_transcript', Mock(return_value=Response(status=404))) @patch('xmodule.video_module.VideoModule.get_static_transcript', Mock(return_value=Response(status=404)))
def test_translation_fallback_transcript_feature_disabled(self): def test_translation_fallback_transcript_feature_disabled(self):

View File

@@ -11,7 +11,6 @@ from courseware.module_render import get_module_for_descriptor
from util.module_utils import get_dynamic_descriptor_children from util.module_utils import get_dynamic_descriptor_children
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.mongo.base import BLOCK_TYPES_WITH_CHILDREN from xmodule.modulestore.mongo.base import BLOCK_TYPES_WITH_CHILDREN
from xmodule.video_module.transcripts_model_utils import is_val_transcript_feature_enabled_for_course
class BlockOutline(object): class BlockOutline(object):

View File

@@ -922,7 +922,6 @@ class TestVideoSummaryList(TestVideoAPITestCase, MobileAuthTestMixin, MobileCour
({'uk': 1, 'de': 1}, 'en-subs', ['de', 'en'], ['en', 'uk', 'de']), ({'uk': 1, 'de': 1}, 'en-subs', ['de', 'en'], ['en', 'uk', 'de']),
) )
@ddt.unpack @ddt.unpack
@patch('openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled', Mock(return_value=True))
@patch('xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages') @patch('xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages')
def test_val_transcripts_with_feature_enabled(self, transcripts, english_sub, val_transcripts, def test_val_transcripts_with_feature_enabled(self, transcripts, english_sub, val_transcripts,
expected_transcripts, mock_get_transcript_languages): expected_transcripts, mock_get_transcript_languages):
@@ -973,10 +972,6 @@ class TestTranscriptsDetail(TestVideoAPITestCase, MobileAuthTestMixin, MobileCou
self.login_and_enroll() self.login_and_enroll()
self.api_response(expected_response_code=200, lang='en') self.api_response(expected_response_code=200, lang='en')
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=True),
)
@patch( @patch(
'xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages', 'xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages',
Mock(return_value=['uk']), Mock(return_value=['uk']),
@@ -1009,20 +1004,3 @@ class TestTranscriptsDetail(TestVideoAPITestCase, MobileAuthTestMixin, MobileCou
self.assertEqual(response.content, expected_content) self.assertEqual(response.content, expected_content)
for attribute, value in expected_headers.iteritems(): for attribute, value in expected_headers.iteritems():
self.assertEqual(response.get(attribute), value) self.assertEqual(response.get(attribute), value)
@patch(
'openedx.core.djangoapps.video_config.models.VideoTranscriptEnabledFlag.feature_enabled',
Mock(return_value=False),
)
@patch(
'xmodule.video_module.transcripts_utils.edxval_api.get_available_transcript_languages',
Mock(return_value=['uk']),
)
def test_val_transcript_feature_disabled(self):
"""
Tests transcript retrieval view with val transcripts when
the corresponding feature is disabled.
"""
self.login_and_enroll()
# request to retrieval endpoint will result in 404 as val transcripts are disabled.
self.api_response(expected_response_code=404, lang='uk')

View File

@@ -23,9 +23,6 @@ from xmodule.video_module.transcripts_utils import (
Transcript, Transcript,
get_transcript, get_transcript,
) )
from xmodule.video_module.transcripts_model_utils import (
is_val_transcript_feature_enabled_for_course
)
from ..decorators import mobile_course_access, mobile_view from ..decorators import mobile_course_access, mobile_view
from .serializers import BlockOutline, video_summary from .serializers import BlockOutline, video_summary