예제 #1
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')
예제 #2
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()