Esempio n. 1
0
    def setUpClass(cls):
        super(TestCaseTaskFreeDashboard, cls).setUpClass()

        cls.data_utils = data_helpers.DataHelpers()
        cls.dashboard_tab = dashboard_tab.DashboardTab(cls)
        cls.admin = UserFactory()
        cls.manager = UserFactory()
        cls.member = UserFactory()
        cls.team = TeamFactory(admin=cls.admin,
                               manager=cls.manager,
                               member=cls.member)

        cls.en_video = VideoFactory(primary_audio_language_code='en')
        TeamVideoFactory(team=cls.team, video=cls.en_video)
        cls.fr_video = VideoFactory(primary_audio_language_code='fr')
        TeamVideoFactory(team=cls.team, video=cls.fr_video)
        cls.video = TeamVideoFactory(team=cls.team).video
        pipeline.add_subtitles(cls.en_video,
                               'en',
                               SubtitleSetFactory(),
                               complete=True)
        pipeline.add_subtitles(cls.fr_video,
                               'fr',
                               SubtitleSetFactory(),
                               complete=True)
        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)
Esempio n. 2
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)
Esempio n. 3
0
    def test_dashboard_display_speaker(self):
        """Speaker name displays with title on dashboard. """
        self.dashboard_tab.log_out()
        for lang in ['en', 'ru', 'sv']:
            UserLangFactory(user=self.admin, language=lang)

        self.dashboard_tab.log_in(self.admin.username, 'password')
        self.dashboard_tab.open_team_page(self.ted_team.slug)
        self.assertTrue(
            self.dashboard_tab.dash_task_present(
                task_type='Create Russian subtitles',
                title='Jinsop Lee: TestVideo1'))
Esempio n. 4
0
 def test_result__language_menu(self):
     user = UserFactory()
     user_speaks = ['en', 'pt', 'ru', 'ar']
     for lang in user_speaks:
         UserLangFactory(user=user, language=lang)
     self.watch_pg.log_in(user.username, 'password')
     test_text = 'english'
     title = 'original english with incomplete'
     results_pg = self.watch_pg.basic_search(test_text)
     expected_langs = ['English', 'Portuguese']
     if results_pg.search_has_results():
         self.assertEqual(expected_langs,
                          results_pg.pulldown_languages(title))
     else:
         self.fail('Video search returned no results')
Esempio n. 5
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()
Esempio n. 6
0
    def setUpClass(cls):
        super(TestCaseMessageUsers, cls).setUpClass()

        cls.user_message_pg = user_messages_page.UserMessagesPage(cls)
        cls.new_message_pg = new_message_page.NewMessagePage(cls)
        cls.data_utils = data_helpers.DataHelpers()
        cls.team_owner1 = UserFactory(username='******')
        cls.team_owner2 = UserFactory(username='******')
        cls.team1 = TeamMemberFactory.create(user=cls.team_owner1).team
        cls.team2 = TeamMemberFactory.create(user=cls.team_owner2).team
        cls.logger.info('setup: Create users')
        cls.users = {
                      #username, langauges-spoken
                      'en_only': ['en'],
                      'en_fr': ['en', 'fr'],
                      'pt_br_fr_de': ['pt-br', 'fr', 'de'],
                      'fil': ['fil'],
                      'de_en': ['de', 'en'],
                      'fr_fil': ['fil', 'fr'],
                    }
        cls.team1_managers = ['de_en'] 
        cls.team1_admins = ['en_only', 'en_fr']
        cls.team1_contributors = ['pt_br_fr_de', 'fil']
        cls.team2_admins = ['en_only', 'de_en']
        cls.team2_contributors = ['en_fr', 'pt_br_fr_de', 'fr_fil']



        for username, langs in cls.users.iteritems():
            setattr(cls, username, UserFactory(username=username))
            for lc in langs:
                UserLangFactory(user=getattr(cls, username), language=lc)

        #set the team 1 admins
        for u in cls.team1_admins:
            user = getattr(cls, u)
            TeamMemberFactory.create(
                                     role='ROLE_ADMIN',
                                     team=cls.team1,
                                     user=user)

        #set the team 1 manager 
        for u in cls.team1_managers:
            user = getattr(cls, u)
            TeamMemberFactory.create(
                                     role='ROLE_MANAGER',
                                     team=cls.team1,
                                     user=user)
        #set the team 1 contributors 
        for u in cls.team1_contributors:
            user = getattr(cls, u)
            TeamMemberFactory.create(
                                     role='ROLE_CONTRIBUTOR',
                                     team=cls.team1,
                                     user=user)
        #set the team 2 admins   
        for u in cls.team2_admins:
            user = getattr(cls, u)
            TeamMemberFactory.create(
                                     role='ROLE_ADMIN',
                                     team=cls.team2,
                                     user=user)


        #set the team 2 contributors 
        for u in cls.team2_contributors:
            user = getattr(cls, u)
            TeamMemberFactory.create(
                                     role='ROLE_CONTRIBUTOR',
                                     team=cls.team2,
                                     user=user)

        cls.new_message_pg.open_page("/")