Exemplo n.º 1
0
    def test_check_language_name_fail(self):
        self.original_language.language = 'en'
        self.original_language.save()

        v = self._new_version()

        #this is reliable Ukrainian language
        Subtitle(version=v,
                 subtitle_id=u'AaAaAaAaAa1',
                 subtitle_text=u'Якась не зрозумiла мова.').save()
        Subtitle(version=v,
                 subtitle_id=u'BaBaBaBaBa1',
                 subtitle_text='Якась не зрозумiла мова.').save()

        alarms.check_language_name(v, ignore_statistic=True)

        self.assertEquals(len(mail.outbox), 1)

        v = self._new_version()

        #this one is unreliable
        Subtitle(version=v,
                 subtitle_id=u'AaAaAaAaAa2',
                 subtitle_text=u'Яsdasdзроasdзумiddаsda.').save()
        Subtitle(version=v,
                 subtitle_id=u'BaBaBaBaBa2',
                 subtitle_text='Якasdсьadsdе sdзрdмiлasdва.').save()

        alarms.check_language_name(v, ignore_statistic=True)

        self.assertEquals(len(mail.outbox), 2)
Exemplo n.º 2
0
def _check_alarm(version_id):
    from videos.models import SubtitleVersion
    from videos import alarms
    
    try:
        version = SubtitleVersion.objects.get(id=version_id)
    except SubtitleVersion.DoesNotExist:
        return

    alarms.check_subtitle_version(version)
    alarms.check_other_languages_changes(version)
    alarms.check_language_name(version)    
Exemplo n.º 3
0
 def test_check_language_name_success(self):
     self.original_language.language = 'en'
     self.original_language.save()
     
     v = self._new_version()
     
     Subtitle(version=v, subtitle_id=u'AaAaAaAaAa', subtitle_text='Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.').save()
     Subtitle(version=v, subtitle_id=u'BaBaBaBaBa', subtitle_text='Developed four years ago by a fast-moving online-news operation').save()
     
     alarms.check_language_name(v, ignore_statistic=True)
     
     self.assertEquals(len(mail.outbox), 0)
Exemplo n.º 4
0
 def test_check_language_name_success(self):
     self.original_language.language = 'en'
     self.original_language.save()
     
     v = self._new_version()
     
     Subtitle(version=v, subtitle_id=u'AaAaAaAaAa', subtitle_text='Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.').save()
     Subtitle(version=v, subtitle_id=u'BaBaBaBaBa', subtitle_text='Developed four years ago by a fast-moving online-news operation').save()
     
     alarms.check_language_name(v, ignore_statistic=True)
     
     self.assertEquals(len(mail.outbox), 0)
Exemplo n.º 5
0
def _check_alarm(version_id):
    from videos.models import SubtitleVersion
    from videos import alarms

    try:
        version = SubtitleVersion.objects.get(id=version_id)
    except SubtitleVersion.DoesNotExist:
        return

    alarms.check_subtitle_version(version)
    alarms.check_other_languages_changes(version)
    alarms.check_language_name(version)
Exemplo n.º 6
0
 def test_check_language_name_fail(self):
     self.original_language.language = 'en'
     self.original_language.save()
     
     v = self._new_version()
     
     #this is reliable Ukrainian language
     Subtitle(version=v, subtitle_id=u'AaAaAaAaAa1', subtitle_text=u'Якась не зрозумiла мова.').save()
     Subtitle(version=v, subtitle_id=u'BaBaBaBaBa1', subtitle_text='Якась не зрозумiла мова.').save()
     
     alarms.check_language_name(v, ignore_statistic=True)
     
     self.assertEquals(len(mail.outbox), 1)        
     
     v = self._new_version()
     
     #this one is unreliable
     Subtitle(version=v, subtitle_id=u'AaAaAaAaAa2', subtitle_text=u'Яsdasdзроasdзумiddаsda.').save()
     Subtitle(version=v, subtitle_id=u'BaBaBaBaBa2', subtitle_text='Якasdсьadsdе sdзрdмiлasdва.').save()
     
     alarms.check_language_name(v, ignore_statistic=True)
     
     self.assertEquals(len(mail.outbox), 2)             
Exemplo n.º 7
0
 def _check_alarms(self, version):
     alarms.check_subtitle_version(version)
     alarms.check_other_languages_changes(version)
     alarms.check_language_name(version)