예제 #1
0
 def test_exists(self):
     unit = Unit.objects.all()[0]
     request = HttpRequest()
     request.user = self.user
     # Create fake fulltext entry
     other = unit.translation.unit_set.exclude(pk=unit.pk)[0]
     other.source = unit.source
     other.target = 'Preklad'
     other.state = STATE_TRANSLATED
     other.save()
     update_fulltext(
         pk=other.pk,
         source=force_text(unit.source),
         context=force_text(unit.context),
         location=force_text(unit.location),
         target=force_text(other.target),
         comment='',
         language=force_text(unit.translation.language.code),
     )
     # Perform lookup
     machine = WeblateTranslation()
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         request,
     )
     self.assertNotEqual(results, [])
예제 #2
0
파일: tests.py 프로젝트: M0Rf30/weblate
 def test_exists(self):
     unit = Unit.objects.filter(translation__language_code="cs")[0]
     # Create fake fulltext entry
     other = unit.translation.unit_set.exclude(pk=unit.pk)[0]
     other.source = unit.source
     other.target = 'Preklad'
     other.state = STATE_TRANSLATED
     other.save()
     update_fulltext(
         None,
         pk=other.pk,
         source=force_str(unit.source),
         context=force_str(unit.context),
         location=force_str(unit.location),
         target=force_str(other.target),
         note='',
         language=force_str(unit.translation.language.code),
     )
     # Perform lookup
     machine = WeblateTranslation()
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         self.user,
     )
     self.assertNotEqual(results, [])
예제 #3
0
 def test_same(self):
     machine = WeblateTranslation()
     unit = Unit.objects.all()[0]
     results = machine.translate(unit.translation.language.code,
                                 unit.get_source_plurals()[0], unit,
                                 self.user)
     self.assertEqual(results, [])
예제 #4
0
파일: tests.py 프로젝트: dekoza/weblate
 def test_exists(self):
     unit = Unit.objects.all()[0]
     request = HttpRequest()
     request.user = self.user
     # Create fake fulltext entry
     other = unit.translation.unit_set.exclude(pk=unit.pk)[0]
     other.source = unit.source
     other.target = 'Preklad'
     other.state = STATE_TRANSLATED
     other.save()
     update_fulltext(
         pk=other.pk,
         source=force_text(unit.source),
         context=force_text(unit.context),
         location=force_text(unit.location),
         target=force_text(other.target),
         comment='',
         language=force_text(unit.translation.language.code),
     )
     # Perform lookup
     machine = WeblateTranslation()
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         request,
     )
     self.assertNotEqual(results, [])
예제 #5
0
파일: tests.py 프로젝트: M0Rf30/weblate
 def test_empty(self):
     machine = WeblateTranslation()
     unit = Unit.objects.filter(translation__language_code="cs")[0]
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         self.user,
     )
     self.assertEqual(results, [])
예제 #6
0
파일: tests.py 프로젝트: daleathan/weblate
 def test_same(self):
     machine = WeblateTranslation()
     unit = Unit.objects.all()[0]
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         self.user
     )
     self.assertEqual(results, [])
예제 #7
0
파일: tests.py 프로젝트: sitedata/weblate
 def test_exists(self):
     unit = Unit.objects.filter(translation__language_code="cs")[0]
     # Create fake fulltext entry
     other = unit.translation.unit_set.exclude(pk=unit.pk)[0]
     other.source = unit.source
     other.target = "Preklad"
     other.state = STATE_TRANSLATED
     other.save()
     # Perform lookup
     machine = WeblateTranslation()
     results = machine.translate(unit, self.user)
     self.assertNotEqual(results, [])
예제 #8
0
 def test_empty(self):
     machine = WeblateTranslation()
     unit = Unit.objects.all()[0]
     request = HttpRequest()
     request.user = self.user
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         request,
     )
     self.assertEqual(results, [])
예제 #9
0
파일: tests.py 프로젝트: dekoza/weblate
 def test_empty(self):
     machine = WeblateTranslation()
     unit = Unit.objects.all()[0]
     request = HttpRequest()
     request.user = self.user
     results = machine.translate(
         unit.translation.language.code,
         unit.get_source_plurals()[0],
         unit,
         request,
     )
     self.assertEqual(results, [])
예제 #10
0
파일: tests.py 프로젝트: sitedata/weblate
 def test_empty(self):
     machine = WeblateTranslation()
     results = machine.translate(self.get_unit(), self.user)
     self.assertEqual(results, [])