Exemplo n.º 1
0
 def test_sent_back(self):
     self.setup_team()
     # go through the subtitle task phase
     task = Task(team=self.team,
                 team_video=self.team_video,
                 language='en',
                 type=Task.TYPE_IDS['Subtitle'],
                 assignee=self.user)
     lang = self.add_completed_subtitles('en', [
         (0, 1000, "Hello, ", {
             'new_paragraph': True
         }),
         (1500, 2500, "World"),
     ],
                                         visibility='private')
     task.new_subtitle_version = lang.get_tip(public=False)
     review_task = task.complete()
     # have the video get sent back in the review phase
     self.assertEquals(review_task.type, Task.TYPE_IDS['Review'])
     review_task.assignee = self.user
     review_task.approved = Task.APPROVED_IDS['Rejected']
     new_subtitle_task = review_task.complete()
     # now in the approval phase
     self.assertEquals(new_subtitle_task.type, Task.TYPE_IDS['Subtitle'])
     self.assertEquals(
         views.LanguageList(self.video).items, [
             ('English', 'needs-review', ['original', 'needs editing'
                                          ], lang.get_absolute_url()),
         ])
Exemplo n.º 2
0
 def test_complete(self):
     lang = self.add_completed_subtitles('ar', [
         (0, 1000, "Hello, ", {
             'new_paragraph': True
         }),
         (1500, 2500, "World"),
     ])
     self.assertEquals(
         views.LanguageList(self.video).items, [
             ('Arabic', 'complete', [], lang.get_absolute_url()),
         ])
Exemplo n.º 3
0
 def test_original(self):
     lang = self.add_completed_subtitles('en', [
         (0, 1000, "Hello, ", {
             'new_paragraph': True
         }),
         (1500, 2500, "World"),
     ])
     self.assertEquals(
         views.LanguageList(self.video).items, [
             ('English', 'complete', ['original'], lang.get_absolute_url()),
         ])
Exemplo n.º 4
0
 def test_timing_incomplete(self):
     lang = self.add_not_completed_subtitles('ja', [
         (0, 1000, "Hello, ", {
             'new_paragraph': True
         }),
         (None, None, "World"),
     ])
     self.assertEquals(
         views.LanguageList(self.video).items, [
             ('Japanese', 'needs-timing', ['incomplete'
                                           ], lang.get_absolute_url()),
         ])
Exemplo n.º 5
0
    def test_multiple_languages(self):
        # english is the original, completed language
        en = self.add_completed_subtitles('en', [
            (0, 1000, "Hello, ", {
                'new_paragraph': True
            }),
            (1500, 2500, "World"),
        ])
        # Kurdish is completed
        ar = self.add_completed_subtitles('ar', [
            (0, 1000, "Hello, ", {
                'new_paragraph': True
            }),
            (1500, 2500, "World"),
        ])
        # french is incomplete
        fr = self.add_not_completed_subtitles('fr', [
            (0, 1000, "Hello, ", {
                'new_paragraph': True
            }),
            (1500, 2500, "World"),
        ])
        # japanese is incomplete, and timing is missing
        ja = self.add_not_completed_subtitles('ja', [
            (0, 1000, "Hello, ", {
                'new_paragraph': True
            }),
            (None, None, "World"),
        ])
        # portuguese shouldn't be listed because there are no lines
        pipeline.add_subtitles(self.video, 'pt', None)

        # LanguageList should return lines for all the languages, with
        # the original first, then the rest in alphabetical order.
        self.assertEquals(
            views.LanguageList(self.video).items, [
                ('English', 'complete', ['original'], en.get_absolute_url()),
                ('Arabic', 'complete', [], ar.get_absolute_url()),
                ('French', 'incomplete', ['incomplete'
                                          ], fr.get_absolute_url()),
                ('Japanese', 'needs-timing', ['incomplete'
                                              ], ja.get_absolute_url()),
            ])
Exemplo n.º 6
0
 def test_no_lines(self):
     pipeline.add_subtitles(self.video, 'pt', None)
     self.assertEquals(views.LanguageList(self.video).items, [])