'Test that the \'/transcripts/save\' endpoint prioritises youtube subtitles over html5 ones
while deciding the current subs for video module.'

def test_prioritize_youtube_sub_on_save(self):

    youtube_id = str(uuid4())
    self.item.data = textwrap.dedent('\n                                                <video    youtube="1:{youtube_id}"    sub="">\n                                                                <source    src="http://www.testvid.org/html5/videos/testvid.mp4"/>\n                                                                <source    src="http://www.testvid2.org/html5/videos/testvid2.webm"/>\n                                                </video>\n                                                '.format(youtube_id=youtube_id))
    modulestore().update_item(self.item, self.user.id)
    self.assert_current_subs(expected_subs='')
    subs = {'start': [100, 200, 240], 'end': [200, 240, 380], 'text': ['subs    #1', 'subs    #2', 'subs    #3']}
    self.save_subs_to_store(subs, youtube_id)
    data = {'locator': unicode(self.video_usage_key), 'metadata': {'sub': youtube_id}}
    resp = self.client.get(reverse('save_transcripts'), {'data': json.dumps(data)})
    self.assertEqual(resp.status_code, 200)
    self.assertEqual(json.loads(resp.content), {'status': 'Success'})
    self.assert_current_subs(expected_subs=youtube_id)
