def turn_on_automatic_tasks(self): self.logger.info('Turning on automatic task creation') #Turn on task autocreation for the team. WorkflowFactory.create(team=self.limited_access_team, autocreate_subtitle=True, autocreate_translate=True, review_allowed=10) #Add some preferred languages to the team. lang_list = ['en', 'ru', 'pt-br'] for language in lang_list: TeamLangPrefFactory(team=self.limited_access_team, language_code=language, preferred=True)
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)
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
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)
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)
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
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)
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)
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')
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')
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)