Fix tests
This commit is contained in:
@@ -217,29 +217,30 @@ class TestMigrateTranscripts(ModuleStoreTestCase):
|
||||
"""
|
||||
Test migrate transcripts logging and output
|
||||
"""
|
||||
course_id = unicode(self.course.id)
|
||||
expected_log = (
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
u'[Transcript migration] process for course {} started. Migrating 1 videos'.format(
|
||||
unicode(self.course.id)
|
||||
u'[Transcript Migration] process for course {} started. Migrating transcripts from 1 videos.'.format(
|
||||
course_id
|
||||
)),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
'[Transcript migration] Migrating 2 transcripts'),
|
||||
u'[Transcript Migration] Migrating 2 transcripts for course {}.'.format(course_id)),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
'[Transcript migration] Result: Language hr transcript of video test_edx_video_id will be migrated'),
|
||||
u'[Transcript Migration] Result: Language hr transcript of video test_edx_video_id will be migrated'),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
'[Transcript migration] Result: Language ge transcript of video test_edx_video_id will be migrated'),
|
||||
u'[Transcript Migration] Result: Language ge transcript of video test_edx_video_id will be migrated'),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
u'[Transcript migration] task submission for course {} ended.'.format(
|
||||
unicode(self.course.id)
|
||||
u'[Transcript Migration] task submission for course {} ended.'.format(
|
||||
course_id
|
||||
)),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
"[Transcript migration] Result: None")
|
||||
"[Transcript Migration] Result: None")
|
||||
)
|
||||
|
||||
with LogCapture(LOGGER_NAME, level=logging.INFO) as logger:
|
||||
@@ -252,33 +253,34 @@ class TestMigrateTranscripts(ModuleStoreTestCase):
|
||||
"""
|
||||
Test migrate transcripts exception logging
|
||||
"""
|
||||
course_id = unicode(self.course_2.id)
|
||||
expected_log = (
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
u'[Transcript migration] process for course {} started. Migrating 1 videos'.format(
|
||||
unicode(self.course_2.id)
|
||||
u'[Transcript Migration] process for course {} started. Migrating transcripts from 1 videos.'.format(
|
||||
course_id
|
||||
)),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
'[Transcript migration] Migrating 1 transcripts'),
|
||||
u'[Transcript Migration] Migrating 1 transcripts for course {}.'.format(course_id)),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
u'[Transcript migration] process for ge transcript started'),
|
||||
u'[Transcript migration] migration process is started for video [test_edx_video_id_2] language [ge].'),
|
||||
(LOGGER_NAME,
|
||||
'ERROR',
|
||||
"[Transcript migration] Exception: u'No transcript for `ge` language'"),
|
||||
u"[Transcript migration] transcript migration failed for video [test_edx_video_id_2] and language [ge]."),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
"[Transcript migration] Result: Failed: language ge of video test_edx_video_id_2 with exception "
|
||||
"[Transcript Migration] Result: Failed: language ge of video test_edx_video_id_2 with exception "
|
||||
"No transcript for `ge` language"),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
u'[Transcript migration] task submission for course {} ended.'.format(
|
||||
unicode(self.course_2.id)
|
||||
u'[Transcript Migration] task submission for course {} ended.'.format(
|
||||
course_id
|
||||
)),
|
||||
(LOGGER_NAME,
|
||||
'INFO',
|
||||
"[Transcript migration] Result: None")
|
||||
"[Transcript Migration] Result: None")
|
||||
)
|
||||
|
||||
with LogCapture(LOGGER_NAME, level=logging.INFO) as logger:
|
||||
|
||||
@@ -183,7 +183,7 @@ def async_migrate_transcript(self, course_key, **kwargs): # pylint: disable=un
|
||||
chord(sub_tasks)(callback)
|
||||
|
||||
LOGGER.info(
|
||||
"[%s] transcripts migration process for course %s ended.",
|
||||
"[%s] task submission for course %s ended.",
|
||||
MIGRATION_LOGS_PREFIX, course_key
|
||||
)
|
||||
|
||||
@@ -240,8 +240,6 @@ def async_migrate_transcript_subtask(self, *args, **kwargs): # pylint: disable=
|
||||
)
|
||||
|
||||
# Start transcript's migration
|
||||
message = None
|
||||
# Clean `edx_video_id`
|
||||
edx_video_id = clean_video_id(video.edx_video_id)
|
||||
|
||||
LOGGER.info(
|
||||
@@ -289,14 +287,9 @@ def async_migrate_transcript_subtask(self, *args, **kwargs): # pylint: disable=
|
||||
else:
|
||||
message = (
|
||||
'Success: transcript (language: {language_code}, edx_video_id: {edx_video_id}) has been migrated '
|
||||
'for video [location].'
|
||||
'for video [{location}].'
|
||||
).format(edx_video_id=edx_video_id, language_code=language_code, location=unicode(video.location))
|
||||
|
||||
# Log to indicate that Migration has been ended.
|
||||
LOGGER.info(
|
||||
"[Transcript migration] migration process is ended for video [%s] language [%s].",
|
||||
edx_video_id, language_code
|
||||
)
|
||||
return message
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user