Esempio n. 1
0
    def setUpClass(cls):
        super(TestCasePublishedVideos, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.user = UserFactory(is_partner=True)
        
        #Add a team with workflows, tasks and preferred languages
        cls.logger.info('setup: Create a team with tasks enabled')
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member,
                               workflow_enabled=True,
                               translate_policy=20,
                               subtitle_policy=20,
                              )
        cls.team_workflow = WorkflowFactory(team = cls.team,
                                            autocreate_subtitle=True,
                                            autocreate_translate=True,
                                            approve_allowed = 10,
                                            review_allowed = 10,
                                           )
        cls.nonmember = UserFactory()

        #Add video to team with published subtitles
        cls.logger.info('Setup: Add video to team with published subs.')
        cls.published = VideoFactory()
        pipeline.add_subtitles(cls.published, 'en', SubtitleSetFactory(),
                               action='publish')
        TeamVideoFactory(team=cls.team, video=cls.published)
        cls.video_pg.open_video_page(cls.published.video_id)
Esempio n. 2
0
    def test_edit(self):
        """Uploaded subtitles can be opened in the editor and saved.

        """
        video_language_pg = video_language_page.VideoLanguagePage(self)
        test_file = 'Untimed_text.srt'
        verification_file = os.path.join(self.subs_data_dir,'Untimed_lines.txt')
        expected_list = [line.strip() for line in codecs.open(
            verification_file, encoding='utf-8')]

        sub_file = os.path.join(self.subs_data_dir, test_file)       
        self.video_pg.upload_subtitles('English', sub_file)

        #Open the language page for the video and click Edit Subtitles 
        video_language_pg.open_video_lang_page(
            self.test_video.video_id, 'en')
        video_language_pg.edit_subtitles()
        self.editor_pg.edit_sub_line("I would like to be under the sea", 1)
        
        #Verify uploaded subs are displayed in the Editor
        #self.assertEqual(expected_list, editor_sub_list)
        self.editor_pg.save("Exit")
        video_language_pg.open_video_lang_page(
            self.test_video.video_id, 'en')
        displayed_list = video_language_pg.displayed_lines()
        #Verify the edited text is in the sub list
        self.assertIn("I would like to be under the sea", displayed_list[0])
        #Verify the origal unedited text is still present in the sub list.
        self.assertTrue(22, len(displayed_list))
Esempio n. 3
0
    def setUpClass(cls):
        super(TestCaseModeratedVideoTitles, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.admin_video_pg = edit_video_page.EditVideoPage(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.videos_tab = VideosTab(cls)
        cls.video_pg = video_page.VideoPage(cls)

        cls.modal = site_modals.SiteModals(cls)
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)

        cls.staff = UserFactory(is_staff=True, is_superuser=True)
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member,
                               workflow_type='O',
                               workflow_enabled=True
                              )

        cls.workflow = WorkflowFactory(
            team = cls.team,
            autocreate_subtitle = True,
            autocreate_translate = False,
            review_allowed = 10,
            approve_allowed = 20)
        #Create a member of the team
        cls.subs_file = os.path.join(os.getcwd(), 'apps','webdriver_testing',
                                    'subtitle_data', 'basic_subs.dfxp')
Esempio n. 4
0
 def setUpClass(cls):
     super(TestCaseDownloadSubs, cls).setUpClass()
     cls.data_utils = data_helpers.DataHelpers()
     cls.user = UserFactory.create()
     cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
     cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                      'webdriver_testing', 'subtitle_data')
Esempio n. 5
0
    def setUpClass(cls):
        super(TestCaseSubmittable, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.modal = site_modals.SiteModals(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)

        cls.user = UserFactory.create(username = '******')
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        td = {'video_url': ('http://qa.pculture.org/amara_tests/'
                     'Birds_short.mp4')
             }
        cls.test_video = VideoFactory(**td)
        cls.video_pg.open_video_page(cls.test_video.video_id)
        cls.video_pg.log_in(cls.user.username, 'password')
 
        #Open the video page and sync the first 3 subs
        cls.video_pg.add_subtitles()
        cls.modal.add_language('English', 'English')
        cls.editor_pg.legacy_editor()
        cls.logger.info('typing subs')
        cls.typed_subs = cls.sub_editor.type_subs()
        cls.sub_editor.continue_to_next_step()
        cls.logger.info('syncing subs')
        cls.sub_editor.sync_subs(len(cls.typed_subs)+2)
        cls.timing_list = cls.sub_editor.sub_timings()
        cls.sub_editor.save_and_exit()
Esempio n. 6
0
 def setUpClass(cls):
     super(TestCaseRevisionNotifications, cls).setUpClass()
     cls.data_utils = data_helpers.DataHelpers()
     cls.user = UserFactory.create()
     cls.video_pg = video_page.VideoPage(cls)
     cls.diffing_pg = diffing_page.DiffingPage(cls)
     cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
     cls.subs_path = os.path.dirname(os.path.abspath(__file__))
Esempio n. 7
0
 def setUpClass(cls):
     super(TestCaseSubtitles, cls).setUpClass()
     cls.user = UserFactory()
     #Create some test data and set subtitle data dir
     cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                      'webdriver_testing', 'subtitle_data')
     cls.video_pg = video_page.VideoPage(cls)
     cls.editor_pg = editor_page.EditorPage(cls)
     cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
Esempio n. 8
0
 def setUpClass(cls):
     super(TestCaseRevisionEdits, cls).setUpClass()
     cls.data_utils = data_helpers.DataHelpers()
     cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
     cls.video_pg = video_page.VideoPage(cls)
     cls.user1 = UserFactory()
     cls.user2 = UserFactory()
     cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                 'subtitle_data')
Esempio n. 9
0
 def test_submit__complete(self):
     """Manually entered subs are submitted and marked as complete.
     """
     self.sub_editor.submit(complete=True)
     complete_langs = self.test_video.completed_subtitle_languages()
     sub_lang = self.test_video.subtitle_language('en')
     self.assertTrue(True, sub_lang.subtitles_complete)
     video_language_pg = video_language_page.VideoLanguagePage(self)
     video_language_pg.open_video_lang_page(self.test_video.video_id, 'en')
     self.assertEqual(4, sub_lang.get_subtitle_count())
Esempio n. 10
0
 def setUpClass(cls):
     super(TestCaseTimedText, cls).setUpClass()
     cls.user = UserFactory()
     cls.video_pg = video_page.VideoPage(cls)
     cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
     cls.test_video = VideoFactory()
     cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                      'webdriver_testing', 'subtitle_data')
     cls.video_pg.open_video_page(cls.test_video.video_id)
     cls.video_pg.log_in(cls.user.username, 'password')
 def setUpClass(cls):
     super(TestCaseUploadTranslation, cls).setUpClass()
     cls.data_utils = data_helpers.DataHelpers()
     cls.user = UserFactory()
     cls.video_pg = video_page.VideoPage(cls)
     cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
     cls.editor_pg = editor_page.EditorPage(cls)
     cls.subs_data_dir = os.path.join(os.getcwd(), 'apps', 
         'webdriver_testing', 'subtitle_data')
     cls.video_pg.open_page('videos/create/')
     cls.video_pg.log_in(cls.user.username, 'password')
Esempio n. 12
0
 def setUpClass(cls):
     super(TestCaseEntryExit, cls).setUpClass()
     cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
     cls.editor_pg = editor_page.EditorPage(cls)
     cls.video_pg = video_page.VideoPage(cls)
     cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
     cls.data_utils = data_helpers.DataHelpers()
     cls.user = UserFactory.create()
     cls.video_pg.open_page('auth/login/')
     cls.user = UserFactory.create()
     cls.video_pg.log_in(cls.user.username, 'password')
Esempio n. 13
0
 def setUpClass(cls):
     super(TestCaseUserSyncing, cls).setUpClass()
     cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
     cls.video_pg = video_page.VideoPage(cls)
     cls.vid_owner = UserFactory()
     cls.account = YouTubeAccountFactory(user=cls.vid_owner,
                                         channel_id='test-channel-id')
     cls.video = YouTubeVideoFactory()
     version = pipeline.add_subtitles(cls.video, 'en', SubtitleSetFactory())
     cls.language = version.subtitle_language
     cls.video_url = cls.video.get_primary_videourl_obj()
Esempio n. 14
0
    def setUpClass(cls):
        super(TestCaseViewSubtitles, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.menu = unisubs_menu.UnisubsMenu(cls)

        cls.user = UserFactory.create()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
        cls.video = VideoUrlFactory().video
        #Upload original language de
        complete = True
        data = {
            'language_code': 'de',
            'video': cls.video.pk,
            'primary_audio_language_code': 'de',
            'draft': open(os.path.join(cls.subs_dir, 'Timed_text.en.srt')),
            'complete': int(complete)
        }
        cls.data_utils.upload_subs(cls.user, **data)

        #Upload sv, translated from de, complete
        data = {
            'language_code': 'sv',
            'video': cls.video.pk,
            'translated_from': 'de',
            'draft': open(os.path.join(cls.subs_dir, 'Timed_text.sv.dfxp')),
            'is_complete': complete,
            'complete': int(complete)
        }
        cls.data_utils.upload_subs(cls.user, **data)
        complete = False
        #Upload ar, translated from de, incomplete
        data = {
            'language_code': 'ar',
            'video': cls.video.pk,
            'draft': open(os.path.join(cls.subs_dir, 'Timed_text.ar.xml')),
            'is_complete': complete,
            'complete': int(complete)
        }
        cls.data_utils.upload_subs(cls.user, **data)
        #Upload hu, translated from sv, incomplete
        data = {
            'language_code': 'hu',
            'video': cls.video.pk,
            'translated_from': 'sv',
            'draft': open(os.path.join(cls.subs_dir, 'Timed_text.hu.ssa')),
            'is_complete': complete,
            'complete': int(complete)
        }
        cls.data_utils.upload_subs(cls.user, **data)
        cls.video_pg.open_video_page(cls.video.video_id)
Esempio n. 15
0
 def setUpClass(cls):
     super(TestCaseFollowing, cls).setUpClass()
     cls.data_utils = data_helpers.DataHelpers()
     cls.user = UserFactory.create()
     cls.video_pg = video_page.VideoPage(cls)
     cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
     cls.create_pg = create_page.CreatePage(cls)
     cls.create_pg.open_create_page()
     cls.video = cls.data_utils.create_video_with_subs(cls.user)
     cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                      'webdriver_testing', 'subtitle_data')
     cls.create_pg.open_create_page()
Esempio n. 16
0
    def setUpClass(cls):
        super(TestCaseComments, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create()
        cls.user2 = UserFactory.create()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
        cls.video = cls.data_utils.create_video_with_subs(cls.user)

        cls.video_pg.open_video_page(cls.video.video_id)
        cls.video_pg.log_in(cls.user2.username, 'password')
        cls.video_pg.open_video_page(cls.video.video_id)
        cls.video_pg.toggle_follow()
Esempio n. 17
0
    def setUpClass(cls):
        super(TestCaseSubtitlesUpload, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create()

        #Create some test data and set subtitle data dir
        cls.test_video = cls.data_utils.create_video()
        cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                         'webdriver_testing', 'subtitle_data')

        cls.video_pg = video_page.VideoPage(cls)
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
        cls.video_language_pg.set_skiphowto()
Esempio n. 18
0
    def setUpClass(cls):
        super(TestCaseSubtitlesFetch, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create()
        cls.data_utils.create_user_api_key(cls.user)

        #Create the test video and path to the sub data directory.
        cls.test_video = cls.data_utils.create_video_with_subs()
        cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                         'webdriver_testing', 'subtitle_data')

        #Open the video language page for the test video.
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
        cls.video_language_pg.open_video_lang_page(cls.test_video.video_id,
                                                   'en')
Esempio n. 19
0
    def test_display_site(self):
        """Upload untimed subs verify content displayed on site lang page. 

        """
        video_language_pg = video_language_page.VideoLanguagePage(self)
        test_file = 'Untimed_text.srt'
        verification_file = os.path.join(self.subs_data_dir,'Untimed_lines.txt')
        expected_list = [line.strip() for line in codecs.open(
            verification_file, encoding='utf-8')]

        sub_file = os.path.join(self.subs_data_dir, test_file)       
        self.video_pg.upload_subtitles('English', sub_file)
        #Open the language page for the video and uploaded lang and compare
        video_language_pg.open_video_lang_page(
            self.test_video.video_id, 'en')
        displayed_list = video_language_pg.displayed_lines()

        self.assertEqual(expected_list, displayed_list)
Esempio n. 20
0
    def setUpClass(cls):
        super(TestCaseDraftVideos, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.menu = unisubs_menu.UnisubsMenu(cls)
        cls.create_modal = dialogs.CreateLanguageSelection(cls)

        cls.user = UserFactory(username='******', is_partner=True)

        #Add a team with workflows, tasks and preferred languages
        cls.logger.info('setup: Create a team with tasks enabled')
        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__subtitle_policy=20,
            team__translate_policy=20,
            user=cls.user,
        ).team
        cls.team_workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,
            review_allowed=10,
        )
        cls.member = TeamMemberFactory.create(
            role="ROLE_CONTRIBUTOR",
            team=cls.team,
            user=UserFactory(username='******')).user
        cls.nonmember = UserFactory()

        #Add video to team with draft subtitles
        cls.logger.info('Setup: Add video to team with draft subs.')
        cls.draft = TeamVideoFactory.create(
            team=cls.team,
            video=cls.data_utils.create_video(),
            added_by=cls.user).video
        data = {
            'visibility': 'private',
            'video': cls.draft,
            'committer': cls.user
        }
        cls.data_utils.add_subs(**data)
        cls.video_pg.open_video_page(cls.draft.video_id)
Esempio n. 21
0
    def setUpClass(cls):
        super(TestCaseViewSubtitles, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
        cls.video = VideoFactory(primary_audio_language_code='de')
        #Upload original language de
        data = {
            'language_code': 'de',
            'video': cls.video,
            'subtitles': 'apps/webdriver_testing/subtitle_data/'
            'Timed_text.en.srt',
            'complete': True,
            'author': cls.user,
            'committer': cls.user
        }
        cls.data_utils.add_subs(**data)

        #Upload sv, translated from de, complete
        data = {
            'language_code': 'sv',
            'video': cls.video,
            'subtitles': 'apps/webdriver_testing/subtitle_data/'
            'Timed_text.sv.dfxp',
            'complete': True,
            'author': cls.user,
            'committer': cls.user
        }
        cls.data_utils.add_subs(**data)
        #Upload hu, translated from sv, incomplete
        data = {
            'language_code': 'hu',
            'video': cls.video,
            'subtitles': 'apps/webdriver_testing/subtitle_data/'
            'Timed_text.hu.ssa',
            'complete': False,
            'author': cls.user,
            'committer': cls.user
        }
        cls.data_utils.add_subs(**data)
        cls.video_pg.open_video_page(cls.video.video_id)
Esempio n. 22
0
    def setUpClass(cls):
        super(TestCasePartialSync, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create(username='******')
        cls.modal = site_modals.SiteModals(cls)
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)

        td = {'video_url': ('http://www.youtube.com/watch?v=WqJineyEszo')}
        cls.test_video = VideoFactory(**td)
        cls.video_pg.open_video_page(cls.test_video.video_id)
        cls.video_pg.log_in(cls.user.username, 'password')
        cls.video_pg.set_skiphowto()
        #Open the video page and sync the first 3 subs
        cls.video_pg.add_subtitles()
        cls.modal.add_language('English', 'English')
        cls.editor_pg.legacy_editor()
        cls.typed_subs = cls.sub_editor.type_subs()
        cls.sub_editor.save_and_exit()
Esempio n. 23
0
    def setUpClass(cls):
        super(TestCaseModeratedSubtitlesUpload, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create(username='******')
        cls.data_utils.create_user_api_key(cls.user)

        #Create some test data and set subtitle data dir
        cls.test_video = cls.data_utils.create_video()
        cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                         'webdriver_testing', 'subtitle_data')

        # self.team_video already has a set of subtitles.
        # Create a team with moderation settings
        cls.my_team = TeamMemberFactory.create(
            team__name='Video Test',
            team__slug='video-test',
            user=cls.user,
            team__is_moderated=True,
            team__workflow_enabled=True,
        ).team

        # Set the team workflow to peer review required.
        workflow = WorkflowFactory(team=cls.my_team)
        workflow.review_allowed = 10
        workflow.save()

        #  Add test_video to the team and create a transcription task.
        cls.lang_code = 'en'
        cls.tv = TeamVideoFactory.create(team=cls.my_team,
                                         video=cls.test_video,
                                         added_by=cls.user)
        subtitle_lang = cls.test_video.subtitle_language(cls.lang_code)
        task = TaskFactory(type=10,
                           team=cls.my_team,
                           team_video=cls.tv,
                           language=cls.lang_code)

        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
        cls.tasks_pg = tasks_tab.TasksTab(cls)
Esempio n. 24
0
    def setUpClass(cls):
        super(TestCaseTeamSyncing, cls).setUpClass()
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member)

        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.sync_pg = failed_sync_page.FailedSyncPage(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.account = KalturaAccount.objects.create(team=cls.team,
                                                    partner_id=1492321,
                                                    secret='abcd')
        cls.video = KalturaVideoFactory(name='video')
        TeamVideoFactory(video=cls.video, team=cls.team)
        cls.version = pipeline.add_subtitles(cls.video,
                                             'en',
                                             SubtitleSetFactory(),
                                             complete=True)
        cls.language = cls.version.subtitle_language
        cls.video_url = cls.video.get_primary_videourl_obj()
    def setUpClass(cls):
        super(TestCaseWorkflows, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.video_pg = video_page.VideoPage(cls)

        cls.user = UserFactory.create()
        cls.owner = UserFactory.create()
        cls.basic_team = TeamMemberFactory.create(
            team__workflow_enabled=False,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            user=cls.owner,
        ).team

        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            team__task_assign_policy=10,  #any team
            user=cls.owner,
        ).team
        cls.workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,  # manager
            review_allowed=10,  # peer
        )
        lang_list = ['en', 'ru', 'pt-br', 'de', 'sv']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)

        cls.admin = TeamMemberFactory(role="ROLE_ADMIN", team=cls.team).user
        cls.contributor = TeamMemberFactory(team=cls.team,
                                            role="ROLE_CONTRIBUTOR").user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
        cls.rev1 = os.path.join(cls.subs_dir, 'Timed_text.en.srt')
        cls.rev2 = os.path.join(cls.subs_dir, 'Timed_text.rev2.en.srt')
        de = os.path.join(cls.subs_dir, 'Timed_text.rev3.en.srt')

        cls.sv = os.path.join(cls.subs_dir, 'Timed_text.sv.dfxp')

        #Create en source language 2 revisions - approved.
        cls.video, cls.tv = cls._add_team_video()

        cls._upload_subtitles(cls.video,
                              'en',
                              cls.rev1,
                              cls.contributor,
                              complete=False)
        cls._upload_subtitles(cls.video, 'en', cls.rev2, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.admin)

        #Add sv translation, reviewed
        cls._upload_translation(cls.video, 'sv', cls.sv, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)

        #Add de translation complete waiting review
        cls._upload_translation(cls.video, 'de', cls.sv, cls.contributor)

        #Add ru translation, incomplete.
        cls._upload_translation(cls.video,
                                'ru',
                                cls.sv,
                                cls.contributor,
                                complete=False)
        cls.video.subtitle_language('en').clear_tip_cache()
        sl_sv = cls.video.subtitle_language('sv').clear_tip_cache()

        cls.video_lang_pg.open_video_lang_page(cls.video.video_id, 'en')
    def setUpClass(cls):
        super(TestCaseDeletion, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.watch_pg = watch_page.WatchPage(cls)
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.user = UserFactory.create()
        cls.owner = UserFactory.create()
        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            team__task_assign_policy=10,  #any team
            user=cls.owner,
        ).team
        cls.workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,  # manager
            review_allowed=10,  # peer
        )
        lang_list = ['en', 'ru', 'pt-br', 'de', 'sv']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)

        cls.admin = TeamMemberFactory(role="ROLE_ADMIN", team=cls.team).user
        cls.contributor = TeamMemberFactory(team=cls.team,
                                            role="ROLE_CONTRIBUTOR").user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
        cls.rev1 = os.path.join(cls.subs_dir, 'Timed_text.en.srt')
        cls.rev2 = os.path.join(cls.subs_dir, 'Timed_text.rev2.en.srt')

        cls.sv = os.path.join(cls.subs_dir, 'Timed_text.sv.dfxp')
        ru = os.path.join(cls.subs_dir, 'less_lines.ssa')

        cls.logger.info("""
                         Create video with en as primary audio lang.
                            Subtitle, review and approve.
                            Translate to: 
                                sv: reviewed
                                de: complete, needs review
                                ru: incomplete
                         Delete Subtitle Language en + sv and de.
                         """)

        #Create en source language 2 revisions - approved.
        cls.video, cls.tv = cls._add_team_video()
        cls._upload_subtitles(cls.video,
                              'en',
                              cls.rev1,
                              cls.contributor,
                              complete=False)
        cls._upload_subtitles(cls.video, 'en', cls.rev2, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.admin)

        #Add sv translation, reviewed
        cls._upload_translation(cls.video, 'sv', cls.sv, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)

        #Add it translation, reviewed
        cls._upload_translation(cls.video, 'it', cls.sv, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)

        #Add hr translation, needs review
        cls._upload_translation(cls.video, 'hr', cls.sv, cls.contributor)

        #Add de translation complete waiting review
        cls._upload_translation(cls.video, 'de', cls.sv, cls.contributor)

        #Add ru translation, incomplete.
        cls._upload_translation(cls.video,
                                'ru',
                                cls.sv,
                                cls.contributor,
                                complete=False)

        cls.video_lang_pg.open_video_lang_page(cls.video.video_id, 'en')
        cls.video_lang_pg.log_in(cls.owner.username, 'password')
        cls.video_lang_pg.page_refresh()

        #Delete English subtitle language + Swedish and German
        cls.video_lang_pg.delete_subtitle_language(['Swedish', 'German'])
        management.call_command('update_index', interactive=False)
        management.call_command('update_video_metadata')
Esempio n. 27
0
    def setUpClass(cls):
        super(TestCaseTED, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.profile_dash_pg = profile_dash_page.ProfileDashPage(cls)

        cls.activity_tab = ActivityTab(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.dashboard_tab = DashboardTab(cls)
        cls.videos_tab = VideosTab(cls)

        cls.watch_pg = watch_page.WatchPage(cls)

        cls.logger.info("Create TED teams")
        cls.admin = UserFactory()
        for lang in ['en', 'fi', 'sv']:
            UserLangFactory(user=cls.admin, language=lang)
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.ted_team = TeamFactory(admin=cls.admin,
                                   manager=cls.manager,
                                   member=cls.member,
                                   slug='ted',
                                   workflow_enabled=True,
                                   name='TED')
        cls.team_member = TeamMemberFactory(team=cls.ted_team)
        WorkflowFactory(
            team=cls.ted_team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=20,
            review_allowed=10,
        )

        cls.ted_project = ProjectFactory.create(team=cls.ted_team,
                                                name='TedTalks',
                                                slug='tedtalks')

        lang_list = ['en', 'ru', 'pt-br', 'de', 'sv', 'fi']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.ted_team,
                                       language_code=language,
                                       preferred=True)

        entries = [{
            'ted_talkid':
            1806,
            'ted_duration':
            '00:09:03',
            'summary':
            'Stuff about the video',
            'ted_speakername':
            'Jinsop Lee',
            'title':
            'TestVideo1',
            'links': [{
                'rel': 'enclosure',
                'href': 'http://unisubs.example.com/video1806.mp4',
                'hreflang': 'en',
            }],
            'updated_parsed':
            time.localtime(10000)
        }, {
            'ted_talkid':
            1801,
            'ted_duration':
            '00:12:17',
            'summary':
            'Stuff about the video',
            'title':
            'NoSpeakerVideo',
            'links': [{
                'rel': 'enclosure',
                'href': 'http://unisubs.example.com/video1801.mp4',
                'hreflang': 'en',
            }],
            'updated_parsed':
            time.localtime(10000)
        }]
        for entry in entries:
            tasks._parse_entry(cls.ted_team, entry, cls.team_member,
                               cls.ted_project)

        cls.speaker_video, _ = Video.get_or_create_for_url(
            'http://unisubs.example.com/video1806.mp4')
        cls.nospeaker_video, _ = Video.get_or_create_for_url(
            'http://unisubs.example.com/video1801.mp4')

        #Add approved 'en' subs speaker name
        speaker_data = {'speaker-name': 'Santa'}
        cls._create_subs(cls.speaker_video,
                         'en',
                         complete=None,
                         metadata=speaker_data)
        cls.data_utils.complete_review_task(cls.speaker_video.get_team_video(),
                                            20, cls.admin)
        cls.data_utils.complete_approve_task(
            cls.speaker_video.get_team_video(), 20, cls.admin)

        #Add approved 'sv' translation with speaker name
        speaker_data = {'speaker-name': 'TomTom'}
        cls._create_subs(cls.speaker_video,
                         'sv',
                         True,
                         metadata=speaker_data,
                         title='sv subs title')
        cls.data_utils.complete_review_task(cls.speaker_video.get_team_video(),
                                            20, cls.admin)
        sv = cls.speaker_video.subtitle_language('sv').get_tip()
        sv.update_metadata({'speaker-name': 'Jultomten'})
        cls.data_utils.complete_approve_task(
            cls.speaker_video.get_team_video(), 20, cls.admin)

        #Add draft 'de' subs reviewed with speaker name
        speaker_data = {'speaker-name': 'Klaus'}
        cls._create_subs(cls.speaker_video,
                         'de',
                         True,
                         metadata=speaker_data,
                         title='de subs title')
        cls.data_utils.complete_review_task(cls.speaker_video.get_team_video(),
                                            20, cls.admin)
        #Add ru draft, no speaker name
        cls._create_subs(cls.speaker_video, 'ru')
        management.call_command('update_index', interactive=False)
        management.call_command('index_team_videos', 'ted')
        cls.video_pg.open_video_page(cls.speaker_video.video_id)

        #Assign Finnish to Admin
        tv = cls.speaker_video.get_team_video()
        task = tv.task_set.incomplete().filter(language='fi')[0]
        task.assignee = cls.admin
        task.save()