Ejemplo n.º 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 = TeamMemberFactory(role="ROLE_MANAGER",
                                     team=cls.team).user
     cls.admin = TeamMemberFactory(role="ROLE_ADMIN", team=cls.team).user
     cls.member = TeamMemberFactory.create(role="ROLE_CONTRIBUTOR",
                                           team=cls.team).user
     cls.members_tab.open_members_page(cls.team.slug)
Ejemplo n.º 2
0
    def _old_to_new_sv_review(self):
        self.logger.info('creating video and adding to team')
        video = Video.objects.all()[0]
        member = TeamMemberFactory(team=self.team).user

        #Add video to team and create a review task
        tv = TeamVideoFactory(team=self.team, added_by=self.user, video=video)
        translate_task = TaskFactory.build(type=20,
                                           team=self.team,
                                           team_video=tv,
                                           language='sv',
                                           assignee=member)

        self.logger.info('complete the translate task')
        translate_task.new_subtitle_version = translate_task.get_subtitle_version(
        )
        translate_task.save()
        task = translate_task.complete()
        self.logger.info('perform review task to open in old editor')
        self.tasks_tab.open_tasks_tab(self.team.slug)
        self.tasks_tab.log_in(member.username, 'password')

        self.tasks_tab.open_tasks_tab(self.team.slug)

        self.tasks_tab.open_page('teams/{0}/tasks/?team_video={1}'
                                 '&assignee=anyone&lang=sv'.format(
                                     self.team.slug, tv.pk))
        self.tasks_tab.perform_and_assign_task('Review Swedish Subtitles',
                                               video.title)
        self.sub_editor.continue_to_next_step()
        self.logger.info('open in new editor')
        self.sub_editor.open_in_beta_editor()
        return video, tv
        self.editor_pg.exit()
Ejemplo n.º 3
0
    def setUpClass(cls):
        super(TestCaseRollbackRevision, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.diffing_pg = diffing_page.DiffingPage(cls)
        cls.video_pg = video_page.VideoPage(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.team_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 = TeamAdminMemberFactory(team=cls.team).user
        cls.contributor = TeamMemberFactory(team=cls.team).user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
Ejemplo n.º 4
0
    def test_leave__admin(self):
        """An admin can leave the team.

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

        self.team_dir_pg.log_in(admin.username, 'password')
        self.team_dir_pg.leave_team(self.team.slug)
        self.assertTrue(self.team_dir_pg.leave_team_successful())
Ejemplo n.º 5
0
    def test_leave__second_to_last_owner(self):
        """Second to last owner can leave the team.

        """
        owner2 = TeamMemberFactory(team = self.team).user

        self.team_dir_pg.log_in(owner2.username, 'password')
        self.team_dir_pg.leave_team(self.team.slug)
        self.assertTrue(self.team_dir_pg.leave_team_successful())
Ejemplo n.º 6
0
    def test_leave__contributor(self):
        """A contributor can leave a team.

        """
        contributor = TeamMemberFactory(role="ROLE_CONTRIBUTOR",team = self.team).user

        self.team_dir_pg.log_in(contributor.username, 'password')
        self.team_dir_pg.leave_team(self.team.slug)
        self.assertTrue(self.team_dir_pg.leave_team_successful())
Ejemplo n.º 7
0
    def test_leave__ui(self):
        """A contributor leaves team by clicking leave link.

        """
        contributor = TeamMemberFactory(role="ROLE_CONTRIBUTOR",team = self.team).user

        self.team_dir_pg.log_in(contributor.username, 'password')
        self.team_dir_pg.open_my_teams_page()
        self.team_dir_pg.click_leave_link(self.team.name)
        self.assertTrue(self.team_dir_pg.leave_team_successful())
Ejemplo n.º 8
0
    def test_response__reviewer(self):
        team, owner = self._create_team()
        member = TeamMemberFactory(team=team).user

        video, tv = self._create_video_with_complete_transcript(team, owner)
        self.data_utils.complete_review_task(tv, 20, member)
        self.data_utils.complete_approve_task(tv, 20, owner)

        url_part = ('videos/%s/languages/' % video.video_id)
        _, response = self.data_utils.api_get_request(self.user, url_part, output_type='json')
        self.assertIn(member.username, response['objects'][0]['reviewer'])
Ejemplo n.º 9
0
    def setUpClass(cls):
        super(TestCaseNoWorkflow, 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.team = TeamMemberFactory.create(
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            user=cls.owner,
        ).team
        cls.admin = TeamAdminMemberFactory(team=cls.team).user
        cls.contributor = TeamMemberFactory(team=cls.team).user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
    def _create_video_with_complete_transcript(self, team, owner):
        sub_file = os.path.join(os.getcwd(), 'apps', 'webdriver_testing', 
                                 'subtitle_data', 'Timed_text.en.srt')
        member = TeamMemberFactory(team=team, role='ROLE_CONTRIBUTOR').user

        video = VideoUrlFactory().video
        tv = TeamVideoFactory.create(
            team=team, 
            video=video, 
            added_by=owner)
        data = {
                     'language_code': 'en',
                     'video': video,
                     'visibility': 'private',
                     'complete': True,
                     'committer': member
                    }
        self.data_utils.add_subs(**data)
        return video, tv
Ejemplo n.º 11
0
 def _create_team_member(self, team):
     member = TeamMemberFactory(team=team).user
     return dict(username=member.username, password='******')
Ejemplo n.º 12
0
    def setUpClass(cls):
        super(TestCaseUnpublishLast, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.sub_editor = subtitle_editor.SubtitleEditor(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 = TeamAdminMemberFactory(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/?lang=all&assignee=anyone' %
                                cls.team.slug)