Esempio n. 1
0
    def setUpClass(cls):
        super(TestCaseTeamMessages, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.a_team_pg = ATeamPage(cls)
        cls.members_tab = members_tab.MembersTab(cls)
        cls.messages_tab = messages_tab.MessagesTab(cls)
        cls.user_message_pg = user_messages_page.UserMessagesPage(cls)
        cls.non_member = UserFactory.create(username='******')
        cls.team_owner = UserFactory.create(is_partner = True)

        #CREATE AN APPLICATION-ONLY TEAM 
        cls.team = TeamMemberFactory.create(
            team__membership_policy = 1,
            user = cls.team_owner,
            ).team

        cls.team_member = TeamMemberFactory.create(role="ROLE_CONTRIBUTOR",
                                           user=UserFactory(),
                                           team=cls.team).user

        #ADD THE TEST MESSAGES TO THE TEST TEAM
        cls.members_tab.open_members_page(cls.team.slug)
        cls.members_tab.log_in(cls.team_owner.username, 'password')
        cls.messages_tab.open_messages_tab(cls.team.slug)
        cls.messages_tab.edit_messages(cls._TEST_MESSAGES)
Esempio n. 2
0
    def test_directory__sort_by_newest(self):
        """sort teams list by newest.

        """
        TeamMemberFactory.create(team__name='new team',
                                 team__slug='new-team',
                                 user=UserFactory.create())
        self.teams_dir_pg.sort("date")
        self.assertEqual('new team', self.teams_dir_pg.first_team())
Esempio n. 3
0
    def setUpClass(cls):
        super(TestCaseVideoResource, cls).setUpClass()
        cls.user = UserFactory.create(username='******')
        cls.data_utils = data_helpers.DataHelpers()

        cls.test_video = cls.data_utils.create_video()
        cls.open_team = TeamMemberFactory.create(
            team__name="Cool team",
            team__slug='team-with-projects',
            team__description='this is the coolest, most creative team ever',
            user=cls.user,
        ).team
        cls.project1 = TeamProjectFactory(
            team=cls.open_team,
            name='team project one',
            slug='team-project-one',
            description='subtitle project number 1',
            guidelines='do a good job',
            workflow_enabled=False)

        cls.project2 = TeamProjectFactory(team=cls.open_team,
                                          name='team project two',
                                          workflow_enabled=True)
        cls.video_pg = video_page.VideoPage(cls)
        cls.watch_pg = watch_page.WatchPage(cls)
Esempio n. 4
0
    def setUpClass(cls):
        super(TestCaseProjectsAddEdit, cls).setUpClass()
        management.call_command('flush', interactive=False)
        cls.data_utils = data_helpers.DataHelpers()
        cls.videos_tab = videos_tab.VideosTab(cls)
        cls.team_owner = UserFactory.create()
        cls.logger.info('setup: Creating team Video Test')
        cls.team = TeamMemberFactory.create(user=cls.team_owner).team

        cls.logger.info('setup: Adding a team with 2 projects.')
        cls.project1 = TeamProjectFactory.create(team=cls.team)
        cls.project2 = TeamProjectFactory.create(team=cls.team)

        test_videos = [
            'jaws.mp4', 'Birds_short.oggtheora.ogg', 'fireplace.mp4'
        ]
        cls.videos_list = []
        for vid in test_videos:
            video_url = 'http://qa.pculture.org/amara_tests/%s' % vid[0]
            tv = VideoUrlFactory(url=video_url, video__title=vid).video
            v = TeamVideoFactory(video=tv,
                                 team=cls.team,
                                 added_by=cls.team_owner,
                                 project=cls.project2).video
            cls.videos_list.append(v)
        management.call_command('update_index', interactive=False)

        cls.videos_tab.open_videos_tab(cls.team.slug)
        cls.videos_tab.log_in(cls.team_owner.username, 'password')

        cls.project1_page = ('teams/{0}/videos/?project={1}'.format(
            cls.team.slug, cls.project1.slug))
        cls.project2_page = ('teams/{0}/videos/?project={1}'.format(
            cls.team.slug, cls.project2.slug))
    def setUpClass(cls):
        super(TestCaseTeamProjectResource, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()

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

        #create an open team with description text and 2 members
        cls.open_team = TeamMemberFactory.create(
            team__name="Cool team",
            team__slug='team-with-projects',
            team__description='this is the coolest, most creative team ever',
            user=cls.team_owner,
        ).team
        TeamMemberFactory(team=cls.open_team, role='ROLE_ADMIN', user=cls.user)
        #Open to the teams page so you can see what's there.
        cls.project1 = TeamProjectFactory(
            team=cls.open_team,
            name='team project one',
            slug='team-project-one',
            description='subtitle project number 1',
            guidelines='do a good job',
            workflow_enabled=False)

        cls.project2 = TeamProjectFactory(team=cls.open_team,
                                          name='team project two',
                                          workflow_enabled=True)

        cls.team_pg = ATeamPage(cls)
        cls.team_pg.open_team_page(cls.open_team.slug)
Esempio n. 6
0
    def setUpClass(cls):
        super(TestCaseProjectsFilter, cls).setUpClass()
        management.call_command('flush', interactive=False)
        cls.data_utils = data_helpers.DataHelpers()
        cls.videos_tab = videos_tab.VideosTab(cls)
        cls.team_owner = UserFactory.create()
        cls.logger.info('setup: Creating team Video Test')
        cls.team = TeamMemberFactory.create(user=cls.team_owner).team

        cls.manager_user = TeamMemberFactory(role="ROLE_ADMIN",
                                             team=cls.team,
                                             user=UserFactory()).user

        cls.logger.info('setup: Adding project one and project two with '
                        'workflows enabled')
        cls.project1 = TeamProjectFactory.create(
            team=cls.team,
            workflow_enabled=True,
        )

        cls.project2 = TeamProjectFactory.create(team=cls.team,
                                                 workflow_enabled=True)

        data = json.load(open('apps/videos/fixtures/teams-list.json'))
        videos = _create_videos(data, [])
        for video in videos:
            TeamVideoFactory.create(team=cls.team,
                                    video=video,
                                    added_by=cls.manager_user,
                                    project=cls.project2)
        management.call_command('update_index', interactive=False)
        cls.videos_tab.open_videos_tab(cls.team.slug)
        cls.videos_tab.log_in(cls.manager_user.username, 'password')
Esempio n. 7
0
    def setUpClass(cls):
        super(TestCaseAddRemoveEdit, cls).setUpClass()

        cls.data_utils = data_helpers.DataHelpers()
        cls.logger.info("Create team and add 1 video")

        cls.team_owner = UserFactory.create()
        cls.team = TeamMemberFactory.create(user=cls.team_owner).team

        cls.manager_user = TeamMemberFactory(
            role="ROLE_ADMIN",
            team=cls.team,
            user=UserFactory(username='******')).user
        cls.videos_tab = videos_tab.VideosTab(cls)
        data = {
            'url':
            'http://www.youtube.com/watch?v=WqJineyEszo',
            'video__title': ('X Factor Audition - Stop Looking At My '
                             'Mom Rap - Brian Bradley'),
            'type':
            'Y'
        }
        cls.test_video = cls.data_utils.create_video(**data)
        cls.data_utils.add_subs(video=cls.test_video)
        TeamVideoFactory.create(team=cls.team,
                                video=cls.test_video,
                                added_by=cls.manager_user)
        management.call_command('update_index', interactive=False)
        cls.videos_tab.open_videos_tab(cls.team.slug)
Esempio n. 8
0
    def setUpClass(cls):
        super(TestCaseFilterSort, cls).setUpClass()
        #management.call_command('flush', interactive=False)

        cls.data_utils = data_helpers.DataHelpers()
        cls.logger.info("Create team 'video-test' and add 1 video")

        cls.team_owner = UserFactory.create(is_partner=True)
        cls.team = TeamMemberFactory.create(user=cls.team_owner).team
        cls.manager_user = TeamMemberFactory(role="ROLE_ADMIN",
                                             team=cls.team,
                                             user=UserFactory()).user
        cls.videos_tab = videos_tab.VideosTab(cls)
        vidurl_data = {
            'url': 'http://www.youtube.com/watch?v=WqJineyEszo',
            'video__title': 'X Factor Audition - Stop Looking At My Mom Rap',
            'type': 'Y'
        }
        cls.test_video = cls.data_utils.create_video(**vidurl_data)
        cls.data_utils.add_subs(video=cls.test_video)
        TeamVideoFactory.create(team=cls.team,
                                video=cls.test_video,
                                added_by=cls.manager_user)

        videos = cls.data_utils.create_several_team_videos_with_subs(
            cls.team, cls.manager_user)
        management.call_command('update_index', interactive=False)
Esempio n. 9
0
    def test_download__multi_team_new(self):
        """Create a report for several teams.

        """

        team2_user = UserFactory.create()
        team2 = TeamMemberFactory.create(user = team2_user).team
        video2, tv2 = self._create_tv_with_original_subs(team2_user, team2)
        self._upload_sv_translation(video2, team2_user, complete=True)


        for x in range(3):
            self._create_tv_with_original_subs(team2_user, team2)

        self.billing_pg.open_billing_page()
        self.billing_pg.log_in(self.terri.username, 'password')
        self.billing_pg.open_billing_page()
        start = (datetime.date.today() - datetime.timedelta(7))
        end =  (datetime.date.today() + datetime.timedelta(2))
        self.logger.info(start.strftime("%Y-%m-%d"))
        team_names = ','.join([self.team.name, team2.name])
        self.billing_pg.submit_billing_parameters(team_names,
                                                  start.strftime("%Y-%m-%d"),
                                                  end.strftime("%Y-%m-%d"),
                                                  'Crowd sourced')
        report_dl = self.billing_pg.check_latest_report_url()
        self.logger.info(report_dl)
        new_headers = ('Video Title,Video ID,Language,Minutes,Original,'
                      'Language number,Team,Created,Source,User') 
        self.assertEqual(8, len(report_dl))
        self.assertEqual(new_headers, report_dl[0])
Esempio n. 10
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
Esempio n. 11
0
    def setUpClass(cls):
        super(TestCaseAddFeeds, cls).setUpClass()
        cls.user = UserFactory.create()
        cls.team = TeamMemberFactory.create(user=cls.user).team

        cls.feed_pg = add_feed_page.AddFeedPage(cls)
        cls.feed_pg.open_feed_page(cls.team.slug)
        cls.feed_pg.log_in(cls.user.username, 'password')
Esempio n. 12
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. 13
0
    def setUpClass(cls):
        super(TestCaseTeamGuidelines, cls).setUpClass()
        cls.messages_tab = messages_tab.MessagesTab(cls)
        cls.tasks_tab = tasks_tab.TasksTab(cls)
        cls.team_owner = UserFactory.create()

        #CREATE AN OPEN TEAM WITH WORKFLOWS and AUTOTASKS
        cls.team = TeamMemberFactory.create(team__workflow_enabled=True,
                                            user=cls.team_owner).team
        #Turn on Task Autocreation
        WorkflowFactory.create(team=cls.team,
                               autocreate_subtitle=True,
                               autocreate_translate=True,
                               review_allowed=10)
Esempio n. 14
0
    def setUpClass(cls):
        super(TestCaseBilling, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.billing_pg = billing_page.BillingPage(cls)
        cls.terri = UserFactory.create(username='******', 
                                       is_staff=True, is_superuser=True)
        cls.user = UserFactory.create()
        cls.team = TeamMemberFactory.create(user = cls.user).team
        cls.video, cls.tv = cls._create_tv_with_original_subs(cls.user, cls.team)
        cls._upload_sv_translation(cls.video, cls.user, complete=True)

        cls.bill_dict = cls.create_team_bill()
        cls.billing_pg.open_billing_page()
        cls.billing_pg.log_in(cls.terri.username, 'password')
Esempio n. 15
0
    def test_add_team_duplicate(self):
        """Duplicate videos are not added again.

        """
        dup_url = 'http://www.youtube.com/watch?v=WqJineyEszo'

        #Create a second team.
        team2 = TeamMemberFactory.create(user=self.manager_user).team
        #Open the new team and try to submit the video
        self.videos_tab.log_in(self.manager_user.username, 'password')
        self.videos_tab.open_videos_tab(team2.slug)
        self.videos_tab.add_video(dup_url)
        self.assertEqual(self.videos_tab.error_message(),
                         'This video already belongs to a team.')
Esempio n. 16
0
    def test_user(self):
        """User credit with subtitles is listed in the record.

        """
        testuser = TeamMemberFactory.create().user
        video, tv = self._create_tv_with_original_subs(self.user, self.team)
        self._upload_sv_translation(video, testuser, complete=True)
        report = BillingFactory(start_date=(datetime.date.today() - 
                                            datetime.timedelta(1)),
                                end_date=datetime.datetime.now(),
                                )
        report.teams=[self.team]
        report.save()
        report.process()
        bill = 'user-data/%s' % report.csv_file
        bill_dict = self._bill_dict(bill)
        self.assertEqual(self.user.username, bill_dict[video.video_id]['en']['User'])
        self.assertEqual(testuser.username, bill_dict[video.video_id]['sv']['User'])
Esempio n. 17
0
    def test_edit_change_team(self):
        """Edit a video, changing it from 1 team to another.

        """
        video_title = 'qs1-not-transback'
        team2 = TeamMemberFactory.create(user=self.team_owner).team
        videos = self.data_utils.create_several_team_videos_with_subs(
            self.team, self.manager_user)
        management.call_command('update_index', interactive=False)

        self.videos_tab.log_in(self.team_owner.username, 'password')
        self.videos_tab.open_videos_tab(self.team.slug)
        self.videos_tab.search(video_title)
        self.videos_tab.edit_video(
            video=video_title,
            team=team2.name,
        )
        management.call_command('update_index', interactive=False)

        self.videos_tab.open_videos_tab(team2.slug)
        self.assertTrue(self.videos_tab.video_present(video_title))
Esempio n. 18
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
Esempio n. 19
0
    def setUpClass(cls):
        super(TestCaseSearch, cls).setUpClass()
        #management.call_command('flush', interactive=False)

        cls.data_utils = data_helpers.DataHelpers()
        cls.logger.info("Create team 'video-test' and add 1 video")

        cls.team_owner = UserFactory.create(is_partner=True)
        cls.team = TeamMemberFactory.create(user=cls.team_owner).team
        cls.manager_user = TeamMemberFactory(role="ROLE_ADMIN",
                                             team=cls.team,
                                             user=UserFactory()).user
        cls.videos_tab = videos_tab.VideosTab(cls)

        data = {
            'url':
            'http://www.youtube.com/watch?v=WqJineyEszo',
            'video__title': ('X Factor Audition - Stop Looking At My '
                             'Mom Rap - Brian Bradley'),
            'type':
            'Y'
        }
        cls.test_video = cls.data_utils.create_video(**data)
        subs_data = {
            'language_code':
            'en',
            'subtitles': ('apps/webdriver_testing/subtitle_data/'
                          'Timed_text.en.srt'),
            'complete':
            True,
            'video':
            cls.test_video
        }
        cls.data_utils.add_subs(**subs_data)
        TeamVideoFactory.create(team=cls.team,
                                video=cls.test_video,
                                added_by=cls.manager_user)

        management.call_command('update_index', interactive=False)
Esempio n. 20
0
    def setUpClass(cls):
        super(TestCaseVideosDisplay, cls).setUpClass()
        #management.call_command('flush', interactive=False)
        cls.data_utils = data_helpers.DataHelpers()
        cls.videos_tab = videos_tab.VideosTab(cls)
        cls.tasks_tab = TasksTab(cls)

        cls.team_owner = UserFactory.create()

        cls.logger.info('Creating team limited access: workflows enabled, '
                        'video policy set to manager and admin, '
                        'task assign policy set to manager and admin, '
                        'membership policy open.')
        cls.limited_access_team = TeamMemberFactory.create(
            team__membership_policy=4,  #open
            team__video_policy=2,  #manager and admin
            team__task_assign_policy=20,  #manager and admin
            team__workflow_enabled=True,
            user=cls.team_owner,
        ).team

        cls.videos_tab.open_page(cls.limited_access_team.slug)
Esempio n. 21
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. 22
0
    def setUpClass(cls):
        super(TestCaseTranscribe, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.admin_video_pg = edit_video_page.EditVideoPage(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.owner = UserFactory.create(username='******')
        cls.superuser = UserFactory.create(is_staff=True, is_superuser=True)
        cls.transcribe_team = TeamMemberFactory.create(
            user=cls.owner,
            team__slug='ted-transcribe',
            team__workflow_enabled=True,
            team__name='TED Transcribe').team

        cls.transcribe_project = TeamProjectFactory.create(
            team=cls.transcribe_team, name='TedTalks', slug='tedtalks')

        WorkflowFactory(
            team=cls.transcribe_team,
            autocreate_subtitle=True,
            autocreate_translate=False,
            approve_allowed=20,
            review_allowed=10,
        )

        cls.member = TeamMemberFactory(
            role="ROLE_ADMIN",
            team=cls.transcribe_team,
        )
        entries = [{
            'ted_talkid':
            1800,
            'ted_duration':
            '00:14:17',
            'summary':
            'Stuff about the video',
            'ted_speakername':
            'Eleanor Longden',
            'title':
            'The voices in my head',
            'links': [{
                'rel': 'enclosure',
                'href': 'http://unisubs.example.com/video1800.mp4',
                'hreflang': 'en',
            }],
            'updated_parsed':
            time.localtime(10000),
        }, {
            'ted_talkid':
            1801,
            'ted_duration':
            '00:12:17',
            'summary':
            'Stuff about the video',
            'title':
            'No speaker name',
            '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.transcribe_team, entry, cls.member,
                               cls.transcribe_project)

        cls.video, _ = Video.get_or_create_for_url(
            'http://unisubs.example.com/video1800.mp4')
        cls.video_pg.open_video_page(cls.video.video_id)
        cls.video_pg.log_in('TED', 'password')
Esempio n. 23
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.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.owner = UserFactory.create(username='******')
        cls.ted_team = TeamMemberFactory.create(
            user=cls.owner,
            team__slug='ted',
            team__name='TED',
            team__workflow_enabled=True).team

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

        WorkflowFactory(
            team=cls.ted_team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=20,
            review_allowed=10,
        )

        cls.member = TeamMemberFactory(
            role="ROLE_ADMIN",
            team=cls.ted_team,
        )

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

        cls.admin = TeamMemberFactory(role="ROLE_ADMIN",
                                      team=cls.ted_team).user

        cls.contributor = TeamMemberFactory(team=cls.ted_team).user

        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.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=True,
                         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.owner)

        #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.owner)

        #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.owner)
        #Add ru draft, no speaker name
        cls._create_subs(cls.speaker_video, 'ru')
        management.call_command('update_index', interactive=False)
        cls.video_pg.open_video_page(cls.speaker_video.video_id)
    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. 25
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("/")
Esempio n. 26
0
    def setUpClass(cls):
        super(TestCaseViewSubtitles, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        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
        )
        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.owner)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.owner)

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

        #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)
Esempio n. 27
0
    def setUpClass(cls):
        super(TestCaseUnpublishLast, 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.tasks_tab.open_page('teams/%s/tasks/?assignee=anyone' %
                                cls.team.slug)
Esempio n. 28
0
    def setUpClass(cls):
        super(TestCaseTeamsPage, cls).setUpClass()
        management.call_command('flush', interactive=False)
        cls.COOL_TEAM_NAME = "A1 Waay Cool team"

        #CREATE A USER
        cls.cool_user = UserFactory.create(username='******',
                                           password='******')

        cls.logger.info("creating some teams for testing")
        #create 5 open teams
        for x in range(5):
            TeamMemberFactory.create(
                team__name='my team ' + str(x),
                team__slug='my-team-' + str(x),
            )

        #create an open team with description text and 2 members
        cls.team = TeamMemberFactory.create(
            team__name="A1 Waay Cool team",
            team__slug='a1-waay-cool-team',
            team__description='this is the coolest, most creative team ever',
        ).team
        TeamMemberFactory.create(team=cls.team, user=cls.cool_user)
        TeamVideoFactory.create(team=cls.team, added_by=cls.cool_user)

        #create an application team with 3 members and 5 videos
        cls.app_team = TeamMemberFactory.create(
            team__name='the application-only team',
            team__slug='the-application-only-team',
            team__membership_policy=1,
        ).team
        TeamMemberFactory.create(team=cls.app_team, user=UserFactory.create())
        TeamMemberFactory.create(team=cls.app_team, user=cls.cool_user)
        for x in range(5):
            TeamVideoFactory.create(team=cls.app_team, added_by=cls.cool_user)

        #create 1 private invitation team
        cls.priv_team = TeamMemberFactory.create(
            team__name='my own private idaho ',
            team__slug='private-idaho',
            team__membership_policy=2,
            team__is_visible=False,
        ).team

        #create 1 private application team
        cls.priv_team = TeamMemberFactory.create(
            team__name='private application',
            team__slug='private-application',
            team__membership_policy=1,
            team__is_visible=False,
        ).team

        cls.teams_dir_pg = TeamsDirPage(cls)
        cls.a_team_pg = ATeamPage(cls)