'Scenario: Translations removing works correctly w/ preliminary saving
Given I have created a Video component
And I edit the component
And I open tab "Advanced"
And I upload transcript files:
|lang_code|filename               |
|uk       |uk_transcripts.srt     |
|zh       |chinese_transcripts.srt|
And I save changes
Then when I view the video it does show the captions
And I see "ÐÑÐžÐ²ÑÑ, edX Ð²ÑÑÐ°Ñ Ð²Ð°Ñ." text in the captions
And video language menu has "uk, zh" translations
And I edit the component
And I open tab "Advanced"
And I see translations for "uk, zh"
Then I remove translation for "uk" language code
And I save changes
Then when I view the video it does show the captions
And I see "å¥œ åäœåå­Š" text in the captions
And I edit the component
And I open tab "Advanced"
And I see translations for "zh"
Then I remove translation for "zh" language code
And I save changes
Then when I view the video it does not show the captions'

def test_translations_remove_works_w_saving(self):

    self._create_video_component()
    self.edit_component()
    self.open_advanced_tab()
    self.video.upload_translation('uk_transcripts.srt', 'uk')
    self.video.upload_translation('chinese_transcripts.srt', 'zh')
    self.save_unit_settings()
    self.assertTrue(self.video.is_captions_visible())
    unicode_text = '\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd1\x96\xd1\x82,    edX    \xd0\xb2\xd1\x96\xd1\x82\xd0\xb0\xd1\x94    \xd0\xb2\xd0\xb0\xd1\x81.'.decode('utf-8')
    self.assertIn(unicode_text, self.video.captions_text)
    self.assertEqual(self.video.caption_languages.keys(), ['zh', 'uk'])
    self.edit_component()
    self.open_advanced_tab()
    self.assertEqual(self.video.translations(), ['zh', 'uk'])
    self.video.remove_translation('uk')
    self.save_unit_settings()
    self.assertTrue(self.video.is_captions_visible())
    unicode_text = '\xe5\xa5\xbd    \xe5\x90\x84\xe4\xbd\x8d\xe5\x90\x8c\xe5\xad\xa6'.decode('utf-8')
    self.assertIn(unicode_text, self.video.captions_text)
    self.edit_component()
    self.open_advanced_tab()
    self.assertEqual(self.video.translations(), ['zh'])
    self.video.remove_translation('zh')
    self.save_unit_settings()
    self.assertFalse(self.video.is_captions_visible())
