def test_upload_first_time(self): mocker = KalturaApiMocker(self.partner_id, self.secret, self.video_id) mocker.expect_session_start() mocker.expect_captionasset_list(return_captions=[]) mocker.expect_captionasset_add('captionid', 'English') mocker.expect_captionasset_setcontent('captionid', "CaptionData", "English") mocker.expect_session_end() with mocker: kaltura.update_subtitles(self.partner_id, self.secret, self.video_id, "en", "CaptionData")
def test_upload_subsequent_times(self): mocker = KalturaApiMocker(self.partner_id, self.secret, self.video_id) mocker.expect_session_start() mocker.expect_captionasset_list(return_captions=[ ('captionid', 'English', 100, kaltura.PARTNER_DATA_TAG), ]) mocker.expect_captionasset_setcontent('captionid', "CaptionData", "English") mocker.expect_session_end() with mocker: kaltura.update_subtitles(self.partner_id, self.secret, self.video_id, 'en', "CaptionData")
def test_upload_with_other_subtitles(self): mocker = KalturaApiMocker(self.partner_id, self.secret, self.video_id) mocker.expect_session_start() mocker.expect_captionasset_list(return_captions=[ ('captionid', 'English', 100, 'other-partner-data'), ]) mocker.expect_captionasset_add('captionid', 'English') mocker.expect_captionasset_setcontent('captionid', "CaptionData", "English") mocker.expect_session_end() with mocker: kaltura.update_subtitles(self.partner_id, self.secret, self.video_id, 'en', "CaptionData")