Exemple #1
0
    def setUpClass(cls):
        super(TestCaseProjectsFilterSort, 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 = TeamAdminMemberFactory(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)

        cls.videos_tab.open_videos_tab(cls.team.slug)
        cls.videos_tab.log_in(cls.manager_user.username, 'password')
Exemple #2
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 = TeamAdminMemberFactory(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.upload_subs(cls.test_video)
        TeamVideoFactory.create(team=cls.team,
                                video=cls.test_video,
                                added_by=cls.manager_user)

        cls.data_utils.create_user_api_key(cls.team_owner)
        videos = cls.data_utils.create_several_team_videos_with_subs(
            cls.team, cls.manager_user)
        management.call_command('update_index', interactive=False)
Exemple #3
0
    def setUp(self):
        super(TestCaseAddRemoveEdit, self).setUp()
        #management.call_command('flush', interactive=False)

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

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

        self.manager_user = TeamAdminMemberFactory(
            team=self.team, user=UserFactory(username='******')).user
        self.videos_tab = videos_tab.VideosTab(self)
        data = {
            'url':
            'http://www.youtube.com/watch?v=WqJineyEszo',
            'video__title': ('X Factor Audition - Stop Looking At My '
                             'Mom Rap - Brian Bradley'),
            'type':
            'Y'
        }
        self.test_video = self.data_utils.create_video(**data)
        self.data_utils.upload_subs(self.test_video)
        TeamVideoFactory.create(team=self.team,
                                video=self.test_video,
                                added_by=self.manager_user)

        self.videos_tab.open_videos_tab(self.team.slug)
Exemple #4
0
    def test_remove__team_only(self):
        """Remove video from team but NOT site.

        Must be the team owner to get the team vs. site dialog.
        """

        self.videos_tab.log_in(self.team_owner.username, 'password')

        tv = VideoUrlFactory(video__title='team only annihilation').video
        TeamVideoFactory.create(team=self.team,
                                video=tv,
                                added_by=self.manager_user)

        #Search for the video in team videos and remove it.
        self.videos_tab.open_videos_tab(self.team.slug)
        self.videos_tab.search(tv.title)
        self.videos_tab.remove_video(video=tv.title,
                                     removal_action='team-removal')

        #Update the solr index
        management.call_command('update_index', interactive=False)

        #Verify video no longer in teams
        self.assertEqual(tv.get_team_video(), None)

        self.videos_tab.search(tv.title)
        self.assertEqual(self.videos_tab.NO_VIDEOS_TEXT,
                         self.videos_tab.search_no_result())

        #Verify video is present on the site
        watch_pg = watch_page.WatchPage(self)
        watch_pg.open_watch_page()
        results_pg = watch_pg.basic_search(tv.title)
        self.assertTrue(results_pg.search_has_results())
Exemple #5
0
    def test_remove__site(self):
        """Remove video from team and site, total destruction!

        Must be the team owner to get the team vs. site dialog.
        """
        self.videos_tab.log_in(self.team_owner.username, 'password')
        #Create a team video for removal.
        tv = VideoUrlFactory(video__title='total destruction').video
        TeamVideoFactory.create(team=self.team,
                                video=tv,
                                added_by=self.manager_user)
        #Search for the video in team videos and remove it.
        self.videos_tab.open_videos_tab(self.team.slug)
        self.videos_tab.search(tv.title)
        self.videos_tab.remove_video(video=tv.title,
                                     removal_action='total-destruction')

        #Verify video no longer in teams
        self.videos_tab.search(tv.title)
        self.assertEqual(self.videos_tab.NO_VIDEOS_TEXT,
                         self.videos_tab.search_no_result())
        self.videos_tab.open_videos_tab(self.team.slug)

        #Verify video no longer on site
        watch_pg = watch_page.WatchPage(self)
        watch_pg.open_watch_page()
        self.logger.info('searching for the test video %s' % tv.title)
        results_pg = watch_pg.basic_search(tv.title)

        self.assertTrue(results_pg.search_has_no_results())
Exemple #6
0
    def test_pagination__admin(self):
        """Check number of videos displayed per page for team admin.

        """
        for x in range(50):
            TeamVideoFactory.create(team=self.limited_access_team,
                                    video=VideoFactory.create(),
                                    added_by=self.team_owner)
        self.videos_tab.log_in(self.team_owner.username, 'password')
        self.videos_tab.open_videos_tab(self.limited_access_team.slug)
        self.assertEqual(8, self.videos_tab.num_videos())
Exemple #7
0
    def test_pagination__user(self):
        """Check number of videos displayed per page for team contributor.

        """
        contributor = UserFactory(username='******')
        for x in range(50):
            TeamVideoFactory.create(team=self.limited_access_team,
                                    video=VideoFactory.create(),
                                    added_by=self.team_owner)
        self.videos_tab.log_in(contributor.username, 'password')
        self.videos_tab.open_videos_tab(self.limited_access_team.slug)
        self.assertEqual(16, self.videos_tab.num_videos())
Exemple #8
0
    def setUpClass(cls):
        super(TestCaseActivity, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create(is_partner=True)

        #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

        TeamMemberFactory.create(team=cls.open_team, user=UserFactory.create())
        TeamVideoFactory.create(team=cls.open_team, added_by=cls.user)
    def setUpClass(cls):
        super(TestCaseTeamsResource, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.user = UserFactory.create(is_partner=True)
        cls.private_user = UserFactory.create(username='******')
        cls.data_utils.create_user_api_key(cls.user)
        cls.logger.info('setup: creating team data')
        #create 3 open teams
        for x in range(3):
            TeamMemberFactory.create(
                team__name='my team ' + str(x),
                team__slug='my-team-' + str(x),
                user__username='******' + str(x),
            )

        #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__username='******',
        ).team

        TeamMemberFactory.create(team=cls.open_team, user=cls.user)
        TeamVideoFactory.create(team=cls.open_team, added_by=cls.user)

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

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

        #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()
Exemple #10
0
    def setUpClass(cls):
        super(TestCaseTeamsPage, cls).setUpClass()
        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),
                                     user__username='******' + str(x),
                                     user__password='******')

        #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',
            user__username='******',
            user__password='******').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,
            user__username='******',
            user__password='******').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 team
        cls.priv_team = TeamMemberFactory.create(
            team__name='my own private idaho ',
            team__slug='private-idaho',
            team__membership_policy=1,
            team__is_visible=False,
            user__username='******',
            user__password='******').team

        cls.teams_dir_pg = TeamsDirPage(cls)
        cls.a_team_pg = ATeamPage(cls)
    def create_several_team_videos_with_subs(self, team, teamowner, data=None):
        """Uses the helper data from the apps.videos.fixtures to create data.

           The test vidoes are then assigned to the specified team.
           Returns the list of video.
        """
        if not data:
            testdata = simplejson.load(
                open('apps/videos/fixtures/teams-list.json'))
        else:
            testdata = simplejson.load(open(data))
        videos = _create_videos(testdata, [])
        for video in videos:
            TeamVideoFactory.create(team=team, video=video, added_by=teamowner)
        return videos
Exemple #12
0
    def test_sort__most_subtitles(self):
        """Sort on the project page by most subtitles.

        """
        project_page = 'teams/{0}/videos/?project={1}'.format(
            self.team.slug, self.project2.slug)
        data2 = json.load(
            open('apps/webdriver_testing/check_teams/lots_of_subtitles.json'))
        videos2 = _create_videos(data2, [])
        for video in videos2:
            TeamVideoFactory.create(team=self.team,
                                    video=video,
                                    added_by=self.manager_user,
                                    project=self.project2)

        self.videos_tab.open_page(project_page)
        self.videos_tab.video_sort(sort_option='most subtitles')
        self.videos_tab.videos_displayed()
        self.assertEqual(self.videos_tab.first_video_listed(),
                         'lots of translations')
    def test_list__video_update(self):
        """Verify video update activity.
        GET /api2/partners/activity/[activity-id]/

        """
        video = self.data_utils.create_video_with_subs()
        TeamVideoFactory.create(team=self.open_team,
                                video=video,
                                added_by=self.user)

        url_data = {
            'video_url': ('http://qa.pculture.org/amara_tests/fireplace.mp4'),
            'title': 'Test video created via api',
            'duration': 37,
            'team': self.open_team.slug
        }
        url_part = 'videos/'
        _, response = self.data_utils.post_api_request(self.user, url_part,
                                                       url_data)
        self.logger.info(response)

        new_data = {
            'title':
            'MVC webM output sample',
            'description': ('This is a sample vid converted to webM '
                            '720p using Miro Video Converter')
        }
        status, response = self.data_utils.put_api_request(
            self.user, response['resource_uri'], new_data)
        self.logger.info(response)

        #activity_query = '?team={0}&type={1}'.format(
        #    self.open_team.slug, 2)
        activity_query = '?team=%s&type=4' % self.open_team.slug
        url_part = 'activity/%s' % activity_query
        status, response = self.data_utils.api_get_request(
            self.user, url_part, output_type='content')
        self.logger.info(response)
        self.assertEqual(200, status)
Exemple #14
0
    def test_list__video_update(self):
        """Verify video update activity.
        GET /api2/partners/activity/[activity-id]/

        """
        video = self.data_utils.create_video_with_subs(self.user)
        TeamVideoFactory.create(team=self.open_team,
                                video=video,
                                added_by=self.user)

        url_data = {
            'video_url': ('http://qa.pculture.org/amara_tests/fireplace.mp4'),
            'title': 'Test video created via api',
            'duration': 37,
            'team': self.open_team.slug
        }
        url_part = 'videos/'
        r = self.data_utils.make_request(self.user, 'post', url_part,
                                         **url_data)
        response = r.json

        new_data = {
            'title':
            'MVC webM output sample',
            'description': ('This is a sample vid converted to webM '
                            '720p using Miro Video Converter')
        }
        r = self.data_utils.make_request(self.user, 'put',
                                         response['resource_uri'], **new_data)
        response = r.json
        #activity_query = '?team={0}&type={1}'.format(
        #    self.open_team.slug, 2)
        activity_query = '?team=%s&type=4' % self.open_team.slug
        url_part = 'activity/%s' % activity_query
        r = self.data_utils.make_request(self.user, 'get', url_part)
        self.assertEqual(200, r.status_code)
 def _create_tv_with_original_subs(cls, user, team, complete=True):
     member_creds = dict(username=user.username, password='******')
     sub_file = os.path.join(cls.subs_data_dir, 'Timed_text.en.srt')
     video = VideoUrlFactory().video
     tv = TeamVideoFactory.create(team=team, video=video, added_by=user)
     data = {
         'language_code': 'en',
         'video': video.pk,
         'primary_audio_language_code': 'en',
         'draft': open(sub_file),
         'is_complete': complete,
         'complete': int(complete),
     }
     cls.data_utils.upload_subs(video, data, member_creds)
     return video, tv
Exemple #16
0
 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_creds = self._create_team_member(team)
     video = VideoUrlFactory().video
     tv = TeamVideoFactory.create(
         team=team, 
         video=video, 
         added_by=owner)
     orig_data = {'language_code': 'en',
                  'video': video.pk,
                  'primary_audio_language_code': 'en',
                  'draft': open(sub_file),
                  'is_complete': True,
                  'complete': 1,
                 }
     self.data_utils.upload_subs(video, orig_data, member_creds)
     return video, tv
    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
    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()