Esempio n. 1
0
    def test_member__safe_invite(self):
        """Use safe-members api to invite user from 1 team to anther.
          
          POST /api2/partners/teams/[team-slug]/safe-members/
        """

        #create a second team with 'second_member' as a member.
        second_user = UserFactory.create(username='******')
        second_team = TeamMemberFactory.create(
            team__name="normal team",
            team__slug='normal-team',
            team__description='this is the junior team',
            user=self.user,
        ).team
        TeamContributorMemberFactory.create(team=second_team, user=second_user)

        #Create a post the request
        user_details = {
            "username": second_user.username,
            "role": "admin",
            "note": "we need you on our team"
        }
        url_part = 'teams/%s/safe-members/' % self.open_team.slug
        status, response = self.data_utils.post_api_request(
            self.user, url_part, user_details)

        #Login in a verify invitation message is displayed
        usr_messages_pg = user_messages_page.UserMessagesPage(self)
        usr_messages_pg.log_in(second_user.username, 'password')
        usr_messages_pg.open_messages()
        invite_subject = ("You've been invited to team %s on Amara" %
                          self.open_team.name)
        self.assertEqual(invite_subject, usr_messages_pg.message_subject())
Esempio n. 2
0
    def test_member__create_contributor(self):
        """Verify video urls for a particular video are listed.
          
          POST /api2/partners/teams/[team-slug]/members/
        """

        #create a second team with 'second_member' as a member.
        second_user = UserFactory.create(username='******')
        second_team = TeamMemberFactory.create(
            team__name="normal team",
            team__slug='normal-team',
            team__description='this is the junior team',
            user=self.user,
        ).team
        TeamContributorMemberFactory.create(team=second_team, user=second_user)

        user_details = {"username": second_user.username, "role": "admin"}
        url_part = 'teams/%s/members/' % self.open_team.slug
        status, response = self.data_utils.post_api_request(
            self.user, url_part, user_details)

        self.teams_dir_pg.open_page('teams/%s/members/' % self.open_team.slug)
        self.teams_dir_pg.log_in(self.user.username, 'password')

        url_part = 'teams/%s/members/' % self.open_team.slug
        status, response = self.data_utils.api_get_request(self.user, url_part)

        self.assertNotEqual(None, response, "Got a None response")
    def test_delete__contributor(self):
        """A Contributor can not delete the team.

           DELETE /api2/partners/teams/[team-slug]/
        """
        TeamContributorMemberFactory.create(team=self.priv_team,
                                            user=self.user)
        url_part = 'teams/%s/' % self.priv_team.slug
        s, _ = self.data_utils.delete_api_request(self.user, url_part)
        self.assertEqual(s, 403)
Esempio n. 4
0
    def test_browse_suggestion__displayed(self):
        """Browse videos link displayed, when no videos found.

        """
        test_team = TeamMemberFactory.create(
            team__name='No Videos yet',
            team__slug='no-videos',
            user=self.team_owner,
        ).team
        TeamContributorMemberFactory.create(team=test_team,
                                            user=self.mono_glot)

        self.dashboard_tab.log_in(self.mono_glot.username, 'password')
        self.dashboard_tab.open_team_page(test_team.slug)
        self.assertTrue(
            self.dashboard_tab.suggestion_present(suggestion_type='browse'))
Esempio n. 5
0
    def setUpClass(cls):
        super(TestCaseTaskFreeDashboard, cls).setUpClass()

        cls.data_utils = data_helpers.DataHelpers()
        cls.dashboard_tab = dashboard_tab.DashboardTab(cls)

        cls.logger.info('setup: Create a team and team owner, add some videos')
        cls.team_owner = UserFactory()
        cls.team = TeamMemberFactory.create(user=cls.team_owner, ).team
        #Add some videos with various languages required.
        test_videos = [('jaws.mp4', 'fr', 'fr'),
                       ('Birds_short.oggtheora.ogg', None, None),
                       ('fireplace.mp4', 'en', 'en')]
        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_data = {
                    'language_code':
                    vid[1],
                    'video_language':
                    vid[2],
                    'video':
                    video.pk,
                    'draft':
                    open('apps/webdriver_testing/subtitle_data/'
                         'Timed_text.sv.dfxp'),
                    'is_complete':
                    True
                }
                cls.data_utils.upload_subs(video, video_data)

            TeamVideoFactory(video=video,
                             team=cls.team,
                             added_by=cls.team_owner)

        cls.logger.info(
            'setup: Create team members Polly Glott and Mono Glot.')
        cls.polly_glott = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
        cls.mono_glot = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
Esempio n. 6
0
    def setUpClass(cls):
        super(TestCaseMembersTab, cls).setUpClass()
        cls.team_dir_pg = TeamsDirPage(cls)
        cls.user_message_pg = user_messages_page.UserMessagesPage(cls)

        cls.members_tab = members_tab.MembersTab(cls)
        cls.team_owner = UserFactory.create()
        cls.team = TeamMemberFactory.create(
            team__name='Members tab roles Test', user=cls.team_owner).team
        cls.promoted_manager = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory()).user
        cls.promoted_admin = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory()).user
        cls.project = TeamProjectFactory.create(
            team=cls.team,
            workflow_enabled=True,
        )
        cls.members_tab.open_members_page(cls.team.slug)
Esempio n. 7
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)
Esempio n. 8
0
    def setUpClass(cls):
        super(TestCaseTeamMemberResource, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create(username='******', is_partner=True)
        cls.team_member = UserFactory.create(username='******')
        cls.data_utils.create_user_api_key(cls.user)

        #create an open team with description text and 2 members
        cls.open_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',
            user=cls.user,
        ).team

        TeamContributorMemberFactory.create(
            team=cls.open_team, user=UserFactory.create(username='******'))

        #Open to the teams page so you can see what's there.
        cls.teams_dir_pg = TeamsDirPage(cls)
        cls.teams_dir_pg.open_teams_page()
    def setUpClass(cls):
        super(TestCaseMessages, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()

        cls.user = UserFactory.create()
        cls.data_utils.create_user_api_key(cls.user)

        cls.open_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',
            user=cls.user,
        ).team
        cls.team_member = UserFactory.create(username='******')
        TeamContributorMemberFactory.create(team=cls.open_team,
                                            user=cls.team_member)
        for x in range(3):
            TeamContributorMemberFactory.create(team=cls.open_team,
                                                user=UserFactory.create())

        cls.second_user = UserFactory.create(username='******')
        cls.messages_pg = user_messages_page.UserMessagesPage(cls)
        cls.messages_pg.open_messages()
Esempio n. 10
0
    def test_add_suggestion__not_displayed(self):
        """Add videos link not displayed for user with no permissions, when no videos
          found.

        """
        test_team = TeamMemberFactory.create(
            team__name='Admin Manager Video Policy',
            team__slug='video-policy-2',
            team__video_policy=2,
            user=self.team_owner,
        ).team
        team_member = TeamContributorMemberFactory.create(
            team=test_team, user=UserFactory(username='******')).user
        self.dashboard_tab.log_in(team_member.username, 'password')
        self.dashboard_tab.open_team_page(test_team.slug)
        self.assertFalse(
            self.dashboard_tab.suggestion_present(suggestion_type='add'))
Esempio n. 11
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)
        cls.data_utils.create_user_api_key(cls.user)
        #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 = TeamContributorMemberFactory.create(
            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
        cls.data_utils.upload_subs(cls.draft,
                                   data=None,
                                   user=dict(username=cls.user.username,
                                             password='******'))

        cls.video_pg.open_video_page(cls.draft.video_id)
        cls.video_pg.set_skiphowto()
Esempio n. 12
0
    def test_no_langs__available_tasks(self):
        """Members with no lang prefs the list of available tasks in English.

        """
        mono_glot = TeamContributorMemberFactory.create(
            team=self.team, user=UserFactory()).user
        video = self.data_utils.create_video()
        video.primary_audio_language_code = 'fr'
        video.save()
        tv = TeamVideoFactory(team=self.team, added_by=self.user, video=video)
        task = list(tv.task_set.incomplete_subtitle().filter(language='fr'))[0]
        task.assignee = mono_glot
        task.save()

        #Login user and go to team dashboard page
        self.dashboard_tab.log_in(mono_glot.username, 'password')
        self.dashboard_tab.open_team_page(self.team.slug)
        expected_lang_list = ['Create English subtitles']
        langs = self.dashboard_tab.languages_needed('fireplace.mp4')
        self.assertEqual(sorted(langs), sorted(expected_lang_list))
Esempio n. 13
0
    def setUpClass(cls):
        super(TestCaseTeamMessages, cls).setUpClass()
        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 = TeamContributorMemberFactory.create(
            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. 14
0
    def test_member__language_suggestion(self):
        """Members with no lang pref see the prompt to set language preference.

        """
        mono_glot = TeamContributorMemberFactory.create(
            team=self.team, user=UserFactory()).user
        self.dashboard_tab.open_team_page(self.team.slug)
        self.browser.delete_all_cookies()
        self.dashboard_tab.log_in(mono_glot.username, 'password')

        self.logger.info('Subtitle task for jaws video is assigned to Mono '
                         'Glot via api.')
        jaws_vid = self.vid_obj_list[0]  #see setUp for data details.
        task_resp = self.get_task(jaws_vid.video_id, self.team, 'Subtitle',
                                  'fr')
        url_part = task_resp['resource_uri']
        updated_info = {'assignee': mono_glot.username}
        status, response = self.data_utils.put_api_request(
            self.user, url_part, updated_info)

        self.dashboard_tab.open_team_page(self.team.slug)
        self.assertTrue(
            self.dashboard_tab.suggestion_present(
                suggestion_type='authed_language'))
Esempio n. 15
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)