Fix donwload subs for non youtube videos and non-en language.
Check for status in test. Add test for track url. Fix test to use cookie. Use download_track in feature file. Add new tests for get_transcript. Add html5 test. Add content check. Add tests for available_translations dispatch. Disable flaky cms test. Add w/o english transcript tests. Add to changelog.
This commit is contained in:
@@ -369,31 +369,32 @@ Feature: CMS Transcripts
|
||||
And I click transcript button "choose" number 2
|
||||
And I see value "test_transcripts|t_not_exist" in the field "Transcript (primary)"
|
||||
|
||||
# Flaky test fails occasionally in master. https://edx-wiki.atlassian.net/browse/BLD-927
|
||||
#21
|
||||
Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save - > change it to another one HTML5 source w/o transcripts - click on use existing - > change it to another one HTML5 source w/o transcripts - click on use existing
|
||||
Given I have created a Video component with subtitles "t_not_exist"
|
||||
And I edit the component
|
||||
|
||||
And I enter a "t_not_exist.mp4" source to field number 1
|
||||
Then I see status message "found"
|
||||
And I see button "download_to_edit"
|
||||
And I see button "upload_new_timed_transcripts"
|
||||
And I see value "t_not_exist" in the field "Transcript (primary)"
|
||||
|
||||
And I save changes
|
||||
And I edit the component
|
||||
|
||||
And I enter a "video_name_2.mp4" source to field number 1
|
||||
Then I see status message "use existing"
|
||||
And I see button "use_existing"
|
||||
And I click transcript button "use_existing"
|
||||
And I see value "video_name_2" in the field "Transcript (primary)"
|
||||
|
||||
And I enter a "video_name_3.mp4" source to field number 1
|
||||
Then I see status message "use existing"
|
||||
And I see button "use_existing"
|
||||
And I click transcript button "use_existing"
|
||||
And I see value "video_name_3" in the field "Transcript (primary)"
|
||||
#Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save - > change it to another one HTML5 source w/o #transcripts - click on use existing - > change it to another one HTML5 source w/o transcripts - click on use existing
|
||||
# Given I have created a Video component with subtitles "t_not_exist"
|
||||
# And I edit the component
|
||||
#
|
||||
# And I enter a "t_not_exist.mp4" source to field number 1
|
||||
# Then I see status message "found"
|
||||
# And I see button "download_to_edit"
|
||||
# And I see button "upload_new_timed_transcripts"
|
||||
# And I see value "t_not_exist" in the field "Transcript (primary)"
|
||||
#
|
||||
# And I save changes
|
||||
# And I edit the component
|
||||
#
|
||||
# And I enter a "video_name_2.mp4" source to field number 1
|
||||
# Then I see status message "use existing"
|
||||
# And I see button "use_existing"
|
||||
# And I click transcript button "use_existing"
|
||||
# And I see value "video_name_2" in the field "Transcript (primary)"
|
||||
#
|
||||
# And I enter a "video_name_3.mp4" source to field number 1
|
||||
# Then I see status message "use existing"
|
||||
# And I see button "use_existing"
|
||||
# And I click transcript button "use_existing"
|
||||
# And I see value "video_name_3" in the field "Transcript (primary)"
|
||||
|
||||
#22
|
||||
Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save -> change it to another one HTML5 source w/o transcripts - click on use existing -> change it to another one HTML5 source w/o transcripts - do not click on use existing -> change it to another one HTML5 source w/o transcripts - click on use existing
|
||||
|
||||
@@ -487,3 +487,64 @@ class TestYoutubeTranscripts(unittest.TestCase):
|
||||
transcripts = transcripts_utils.get_transcripts_from_youtube(youtube_id, settings, translation)
|
||||
self.assertEqual(transcripts, expected_transcripts)
|
||||
mock_get.assert_called_with('http://video.google.com/timedtext', params={'lang': 'en', 'v': 'good_youtube_id'})
|
||||
|
||||
class TestTranscript(unittest.TestCase):
|
||||
"""
|
||||
Tests for Transcript class e.g. different transcript conversions.
|
||||
"""
|
||||
def setUp(self):
|
||||
|
||||
self.srt_transcript = textwrap.dedent("""\
|
||||
0
|
||||
00:00:10,500 --> 00:00:13,000
|
||||
Elephant's Dream
|
||||
|
||||
1
|
||||
00:00:15,000 --> 00:00:18,000
|
||||
At the left we can see...
|
||||
|
||||
""")
|
||||
|
||||
|
||||
self.sjson_transcript = textwrap.dedent("""\
|
||||
{
|
||||
"start": [
|
||||
10500,
|
||||
15000
|
||||
],
|
||||
"end": [
|
||||
13000,
|
||||
18000
|
||||
],
|
||||
"text": [
|
||||
"Elephant's Dream",
|
||||
"At the left we can see..."
|
||||
]
|
||||
}
|
||||
""")
|
||||
|
||||
self.txt_transcript = u"Elephant's Dream\nAt the left we can see..."
|
||||
|
||||
def test_convert_srt_to_txt(self):
|
||||
expected = self.txt_transcript
|
||||
actual = transcripts_utils.Transcript.convert(self.srt_transcript, 'srt', 'txt')
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_convert_srt_to_srt(self):
|
||||
expected = self.srt_transcript
|
||||
actual = transcripts_utils.Transcript.convert(self.srt_transcript, 'srt', 'srt')
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_convert_sjson_to_txt(self):
|
||||
expected = self.txt_transcript
|
||||
actual = transcripts_utils.Transcript.convert(self.sjson_transcript, 'sjson', 'txt')
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_convert_sjson_to_srt(self):
|
||||
expected = self.srt_transcript
|
||||
actual = transcripts_utils.Transcript.convert(self.sjson_transcript, 'sjson', 'srt')
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_convert_srt_to_sjson(self):
|
||||
with self.assertRaises(NotImplementedError):
|
||||
transcripts_utils.Transcript.convert(self.srt_transcript, 'srt', 'sjson')
|
||||
|
||||
Reference in New Issue
Block a user