示例#1
0
 def setUpClass(cls):
     super(TestCaseManageMembers, cls).setUpClass()
     cls.members_tab = members_tab.MembersTab(cls)
     cls.team_owner = UserFactory.create()
     cls.team = TeamMemberFactory.create(team__membership_policy=1,
                                         user=cls.team_owner).team
     cls.manager = TeamManagerMemberFactory.create(team=cls.team).user
     cls.admin = TeamAdminMemberFactory.create(team=cls.team).user
     cls.member = TeamContributorMemberFactory.create(team=cls.team).user
     cls.members_tab.open_members_page(cls.team.slug)
示例#2
0
    def test_manager__edit_permission(self):
        """Video policy: manager and admin; manager sees the edit link.

        """
        vids = self.add_some_team_videos()
        self.logger.info('Adding manager user to the team and logging in')
        manager = TeamManagerMemberFactory(
            team=self.limited_access_team,
            user=UserFactory(username='******')).user
        self.videos_tab.log_in(manager.username, 'password')

        self.videos_tab.open_videos_tab(self.limited_access_team.slug)
        self.assertTrue(self.videos_tab.video_has_link(vids[0].title, 'Edit'))
示例#3
0
    def test_restricted_manager__no_edit(self):
        """Video policy: manager and admin; language manager sees no edit link.

        """
        vids = self.add_some_team_videos()
        self.logger.info('Adding English language manager and logging in')
        manager = TeamManagerMemberFactory(
            team=self.limited_access_team,
            user=UserFactory(username='******'))
        TeamManagerLanguageFactory(member=manager, language='en')
        self.videos_tab.log_in(manager.user.username, 'password')

        self.videos_tab.open_videos_tab(self.limited_access_team.slug)
        self.assertFalse(self.videos_tab.video_has_link(vids[0].title, 'Edit'))
示例#4
0
    def test_public__manager_with_no_create_tasks(self):
        """Manager can NOT rollback to draft when create tasks is admin level.

        """
        self.team.task_assign_policy = 30
        self.team.save()
        self.logger.info('TASK POLICY is %s' % self.team.task_assign_policy)
        tm = TeamManagerMemberFactory(team=self.team).user
        video, tv = self._add_team_video()
        v1, _ = self._create_complete_rev(video, self.contributor)
        self._review_and_approve(tv)

        self.video_pg.open_video_page(video.video_id)
        self.video_lang_pg.log_in(tm.username, 'password')
        self.video_lang_pg.open_page(v1.get_absolute_url())
        self.assertFalse(self.video_lang_pg.rollback_exists())
示例#5
0
    def test_restricted_manager__edit(self):
        """Video policy: all team members; language manager sees edit link.

        """
        self.logger.info('setup: Setting video policy to all team members')
        self.limited_access_team.video_policy = 1
        self.limited_access_team.save()

        vids = self.add_some_team_videos()
        self.logger.info('Adding English language manager and logging in')
        manager = TeamManagerMemberFactory(
            team=self.limited_access_team,
            user=UserFactory(username='******'))
        TeamManagerLanguageFactory(member=manager, language='en')
        self.videos_tab.log_in(manager.user.username, 'password')

        self.videos_tab.open_videos_tab(self.limited_access_team.slug)
        self.assertTrue(self.videos_tab.video_has_link(vids[0].title, 'Edit'))
示例#6
0
    def test_manager__no_tasks(self):
        """Task policy: admin only; manager sees no task link.

        """
        self.browser.delete_all_cookies()
        self.logger.info('setup: Setting task policy to admin only')
        self.limited_access_team.task_assign_policy = 30
        self.limited_access_team.save()
        vids = self.add_some_team_videos()
        self.logger.info('Adding manager user to the team and logging in')
        #Create a user who is a manager to the team.
        manager = TeamManagerMemberFactory(
            team=self.limited_access_team,
            user=UserFactory(username='******')).user
        self.videos_tab.log_in(manager.username, 'password')
        self.videos_tab.open_videos_tab(self.limited_access_team.slug)
        self.assertFalse(self.videos_tab.video_has_link(
            vids[0].title, 'Tasks'))
示例#7
0
    def test_public__manager_with_create_tasks(self):
        """Manager can edit public version when create tasks is manager level.

        """
        self.team.task_assign_policy = 20
        self.team.save()
        self.logger.info(self.team.task_assign_policy)

        teammanager = TeamManagerMemberFactory(team=self.team).user
        video, tv = self._add_team_video()
        subs = os.path.join(self.subs_dir, 'Timed_text.en.srt')
        self._upload_en_draft(video,
                              subs,
                              user=self.contributor,
                              complete=True)
        self.video_pg.open_video_page(video.video_id)
        self.video_lang_pg.log_in(teammanager.username, 'password')
        self.video_lang_pg.open_video_lang_page(video.video_id, 'en')
        self.assertEqual('active', self.video_lang_pg.edit_subtitles_active())
示例#8
0
    def test_public__manager_with_no_create_tasks(self):
        """Manager can't edit public version when create tasks is admin level.

        """
        self.team.task_assign_policy = 30
        self.team.save()
        self.logger.info('TASK POLICY is %s' % self.team.task_assign_policy)
        tm = TeamManagerMemberFactory(team=self.team).user
        video, tv = self._add_team_video()
        subs = os.path.join(self.subs_dir, 'Timed_text.en.srt')
        self._upload_en_draft(video,
                              subs,
                              user=self.contributor,
                              complete=True)
        self.video_pg.log_out()
        self.video_pg.open_video_page(video.video_id)
        self.video_lang_pg.log_in(tm.username, 'password')
        self.video_lang_pg.open_video_lang_page(video.video_id, 'en')
        self.assertEqual(self.video_lang_pg.EDIT_INACTIVE_TEXT,
                         self.video_lang_pg.edit_subtitles_active())
示例#9
0
    def setUpClass(cls):
        super(TestCaseTasksEnabledDashboard, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.dashboard_tab = dashboard_tab.DashboardTab(cls)
        cls.user = UserFactory(username='******', is_partner=True)
        cls.data_utils.create_user_api_key(cls.user)
        cls.subs_file = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'oneline.txt')

        #Add a team with workflows, tasks and preferred languages
        cls.logger.info('setup: Create a team with tasks enabled')
        cls.team = TeamMemberFactory.create(
            team__name='Tasks Enabled',
            team__slug='tasks-enabled',
            team__workflow_enabled=True,
            user=cls.user,
        ).team
        cls.team_workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
        )
        cls.team_workflow.review_allowed = 10
        cls.team_workflow.save()
        cls.logger.info('setup: Add some preferred languages to the team.')
        lang_list = ['en', 'ru', 'pt-br', 'fr', 'de', 'es']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)

        #Create some users with different roles and languages.
        polly_speaks = ['en', 'fr', 'ru', 'ar']
        cls.logger.info("setup: Create user Polly who speaks: %s" %
                        polly_speaks)
        cls.polly_glott = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
        cls.logger.info("setup: Create manager reviewer who speaks: %s" %
                        polly_speaks)
        cls.reviewer = TeamManagerMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
        for lang in polly_speaks:
            UserLangFactory(user=cls.polly_glott, language=lang)
            UserLangFactory(user=cls.reviewer, language=lang)

        #Add some videos with various languages required.
        cls.logger.info('setup: Add some videos and set primary audio lang.')
        d = {
            'url': 'http://qa.pculture.org/amara_tests/Birds_short.mp4',
            'video__title': 'Short Birds MP4',
            'video__primary_audio_language_code': 'en'
        }
        cls.non_team_video = cls.data_utils.create_video(**d)
        test_videos = [('jaws.mp4', 'fr'), ('Birds_short.oggtheora.ogg', 'de'),
                       ('fireplace.mp4', 'en'), ('penguins.webm', None),
                       ('trailer.webm', 'en')]
        cls.vid_obj_list = []
        for vid in test_videos:
            vidurl_data = {
                'url': 'http://qa.pculture.org/amara_tests/%s' % vid[0],
                'video__title': vid[0]
            }

            video = cls.data_utils.create_video(**vidurl_data)
            if vid[1] is not None:
                video.primary_audio_language_code = vid[1]
                video.save()
            cls.vid_obj_list.append(video)
            team_video = TeamVideoFactory(video=video,
                                          team=cls.team,
                                          added_by=cls.polly_glott)