Skip to content
Snippets Groups Projects
Commit 9f820c9e authored by Qubad786's avatar Qubad786 Committed by M. Rehan
Browse files

Fix tests

parent 981be5db
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment