Ejemplo n.º 1
0
    def create_workflow_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 = 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=team, language_code=language,
                                       preferred=True)
        cls.contributor = TeamMemberFactory(role="ROLE_CONTRIBUTOR",team=team,
                                     user__first_name='Jerry', 
                                     user__last_name='Garcia',
                                     user__pay_rate_code='L2').user

        cls.contributor2 = TeamMemberFactory(role="ROLE_CONTRIBUTOR",
                team=team,
                user__first_name='Gabriel José de la Concordia'.decode("utf-8"), 
                user__last_name='García Márquez'.decode("utf-8")).user
        cls.admin = TeamMemberFactory(role="ROLE_ADMIN",team=team).user
        cls.manager = TeamMemberFactory(role="ROLE_MANAGER",team=team).user

        return team
Ejemplo n.º 2
0
    def create_workflow_team(cls):
        team = TeamFactory(
            admin=cls.admin,
            manager=cls.manager,
            workflow_enabled=True,
            translate_policy=20,  #any team
            subtitle_policy=20,  #any team
            task_assign_policy=10,  #any team
        )
        cls.workflow = WorkflowFactory(
            team=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=team,
                                       language_code=language,
                                       preferred=True)
        member = UserFactory(first_name='Jerry',
                             last_name='Garcia',
                             pay_rate_code='L2')

        member2 = UserFactory(
            first_name='Gabriel José de la Concordia'.decode("utf8"),
            last_name='García Márquez'.decode("utf8"))
        TeamContributorMemberFactory(user=member, team=team)
        TeamContributorMemberFactory(user=member2, team=team)
        return team, member, member2
Ejemplo n.º 3
0
    def setUpClass(cls):
        super(TestCaseBulkApprove, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.tasks_tab = TasksTab(cls)
        #Create a partner user to own the team.
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.contributor = UserFactory()
        #CREATE AN OPEN TEAM WITH WORKFLOWS and AUTOTASKS
        cls.team = TeamFactory(
            member=cls.contributor,
            manager=cls.manager,
            admin=cls.admin,
            workflow_enabled=True,
        )

        cls.workflow = WorkflowFactory(team=cls.team,
                                       autocreate_subtitle=True,
                                       autocreate_translate=True,
                                       review_allowed=10,
                                       approve_allowed=10)
        lang_list = ['en', 'ru', 'pt-br', 'de', 'sv', 'fr', 'it']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)
Ejemplo n.º 4
0
    def setUpClass(cls):
        super(TestCaseTasks, cls).setUpClass()
        cls.client = APIClient
        cls.data_utils = data_helpers.DataHelpers()
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member,
                               workflow_enabled=True)
        WorkflowFactory.create(team=cls.team,
                               review_allowed=10,
                               approve_allowed=20,
                               autocreate_subtitle=True,
                               autocreate_translate=True)
        lang_list = ['en', 'ru', 'pt-br', 'fr', 'de', 'es']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)
        cls.video = VideoFactory(primary_audio_language_code="en")
        cls.tv = TeamVideoFactory(team=cls.team, video=cls.video)

        #complete transcribe task
        #add 1 draft version of subtitles
        pipeline.add_subtitles(cls.video,
                               'en',
                               SubtitleSetFactory(),
                               committer=cls.member,
                               author=cls.member,
                               complete=False)
        #add a final version of subtitles
        pipeline.add_subtitles(cls.video,
                               'en',
                               SubtitleSetFactory(),
                               committer=cls.member,
                               author=cls.member,
                               complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.manager)
        #complete french translate tasks
        pipeline.add_subtitles(cls.video,
                               'fr',
                               SubtitleSetFactory(),
                               committer=cls.member,
                               author=cls.member,
                               complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.manager)

        #german lang translate needs approve
        pipeline.add_subtitles(cls.video,
                               'de',
                               SubtitleSetFactory(),
                               committer=cls.member,
                               author=cls.member,
                               complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)
Ejemplo n.º 5
0
    def setUpClass(cls):
        super(TestCaseDeleteLast, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.watch_pg = watch_page.WatchPage(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).user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing', 
                                    'subtitle_data') 
        cls.video, cls.tv = cls.create_source_with_multiple_revisions()
        translation = os.path.join(cls.subs_dir, 'Timed_text.sv.dfxp')
        
        #Upload subs - sv - incomplete, de - reviewed, ru - complete needs review
        cls.logger.info("""Uploading subs to get tasks in various stages: """)
        cls.logger.info("""
                         sv: translation started, incomplete
                         ru: translation submitted, needs review
                         de: translation reviewed, needs approve
                         pt-br: not started
                         """)

        cls._upload_lang(cls.video, translation, 'sv', cls.contributor)
        cls._upload_lang(cls.video, translation, 'de', cls.contributor,
                         complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)
        cls._upload_lang(cls.video, translation, 'ru', cls.contributor,
                         complete=True)

        cls.logger.info('Setting visibility override on v3 to private')
        cls.en = cls.video.subtitle_language('en')
        en_v3 = cls.en.get_tip(full=True)
        en_v3.visibility_override = 'private'
        en_v3.save() 
        cls.en.clear_tip_cache() 

        cls.tasks_tab.open_page('teams/%s/tasks/?assignee=anyone'
                                 % cls.team.slug)
Ejemplo n.º 6
0
    def setUpClass(cls):
        super(TestCaseViewSubtitles, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.user = UserFactory()
        cls.basic_team = TeamFactory.create(workflow_enabled=False,
                                            translate_policy=20, #any team
                                            subtitle_policy=20, #any team
                                            admin = cls.user,
                                            )

        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.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', 'fr', 'de', 'sv']
        for language in lang_list:
            TeamLangPrefFactory.create(
                team = cls.team,
                language_code = language,
                preferred = True)                       

        #Create en source language 2 revisions - approved.
        cls.video, cls.tv = cls._add_team_video()
        cls._upload_subtitles(cls.video, 'en', cls.member, 
                              complete=False)
        cls._upload_subtitles(cls.video, 'en', cls.member)
        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_subtitles(cls.video, 'sv', cls.member)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)

        #Add de translation complete waiting review
        cls._upload_subtitles(cls.video, 'de', cls.member)

        #Add ru translation, incomplete.
        cls._upload_subtitles(cls.video, 'ru', cls.member, 
                                complete=False)
Ejemplo n.º 7
0
    def setUpClass(cls):
        super(TestCaseTasksEnabledDashboard, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.modal = site_modals.SiteModals(cls)
        cls.dashboard_tab = dashboard_tab.DashboardTab(cls)
        cls.tasks_tab = tasks_tab.TasksTab(cls)

        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member,
                               workflow_enabled=True)
        cls.team_workflow = WorkflowFactory(team=cls.team,
                                            autocreate_subtitle=True,
                                            autocreate_translate=True,
                                            review_allowed=10)

        langs = ['en', 'ru', 'pt-br', 'fr', 'de', 'es']
        for lc in langs:
            TeamLangPrefFactory(team=cls.team,
                                language_code=lc,
                                preferred=True)

        cls.en_video = VideoFactory(primary_audio_language_code='en')
        TeamVideoFactory(team=cls.team, video=cls.en_video)
        cls.video = TeamVideoFactory(team=cls.team).video
        cls.polly_glott = TeamMemberFactory(team=cls.team, ).user

        polly_speaks = ['en', 'cs', 'ru', 'ar']
        for lang in polly_speaks:
            UserLangFactory(user=cls.polly_glott, language=lang)
Ejemplo n.º 8
0
    def create_workflow_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.user,
        ).team
        cls.workflow = WorkflowFactory(
            team=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=team,
                                       language_code=language,
                                       preferred=True)

        return team
Ejemplo n.º 9
0
    def turn_on_automatic_tasks(self):
        self.logger.info('Turning on automatic task creation')
        #Turn on task autocreation for the team.
        WorkflowFactory.create(team=self.limited_access_team,
                               autocreate_subtitle=True,
                               autocreate_translate=True,
                               review_allowed=10)

        #Add some preferred languages to the team.
        lang_list = ['en', 'ru', 'pt-br']
        for language in lang_list:
            TeamLangPrefFactory(team=self.limited_access_team,
                                language_code=language,
                                preferred=True)
Ejemplo n.º 10
0
    def setUpClass(cls):
        super(TestCaseActivity, cls).setUpClass()
        cls.client = APIClient
        cls.data_utils = data_helpers.DataHelpers()
        cls.staff = UserFactory(is_staff=True)
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member,
                               workflow_enabled=True
                              )
        WorkflowFactory.create(
            team = cls.team,
            review_allowed = 10,
            approve_allowed = 20,
            autocreate_subtitle = True,
            autocreate_translate = True)
        lang_list = ['en', 'ru', 'pt-br', 'fr', 'de', 'es']
        for language in lang_list:
            TeamLangPrefFactory.create(
                team = cls.team,
                language_code = language,
                preferred = True)
        cls.video = VideoFactory(primary_audio_language_code="en")
        cls.tv = TeamVideoFactory(team=cls.team, video=cls.video)

        #complete transcribe task
        #add 1 draft version of subtitles
        pipeline.add_subtitles(cls.video, 'en', SubtitleSetFactory(),
                               committer=cls.member, author=cls.member, complete=False)
        #add a final version of subtitles
        pipeline.add_subtitles(cls.video, 'en', SubtitleSetFactory(),
                               committer=cls.member, author=cls.member, complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.manager)

        time.sleep(2)
        cls.time = int(time.time())
        time.sleep(2)
        #complete french translate tasks
        pipeline.add_subtitles(cls.video, 'fr', SubtitleSetFactory(),
                               committer=cls.member, author=cls.member, complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.manager)
       
        #german lang translate needs approve 
        pipeline.add_subtitles(cls.video, 'de', SubtitleSetFactory(),
                               committer=cls.member, author=cls.member, complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)

        #reject spanish subs in review
        pipeline.add_subtitles(cls.video, 'es', SubtitleSetFactory(),
                               committer=cls.member, author=cls.member, complete=True)
        cls.data_utils.complete_review_task(cls.tv, 30, cls.manager)

        #reject pt-br subs in approve
        pipeline.add_subtitles(cls.video, 'pt-br', SubtitleSetFactory(),
                               committer=cls.member, author=cls.member, complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.manager)
        cls.data_utils.complete_approve_task(cls.tv, 30, cls.manager)

        #add some non-team videos with subs
        cls.user = UserFactory()
        langs = ['en', 'fr', 'de', 'it', 'pt-br']
        for lc in langs:
            cls.vid = VideoFactory(primary_audio_language_code=lc) 
            pipeline.add_subtitles(cls.vid, lc, SubtitleSetFactory(),
                                   complete=True, committer=cls.user, author=cls.user)
            pipeline.add_subtitles(cls.vid, 'en', SubtitleSetFactory(),
                                   committer=cls.user, author=cls.user)
Ejemplo n.º 11
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()
Ejemplo n.º 12
0
    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')
Ejemplo n.º 13
0
    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')