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, [])
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, [])
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, [])
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, [])
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, [])
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, [])
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, [])
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, [])
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, [])
def test_empty(self): machine = WeblateTranslation() results = machine.translate(self.get_unit(), self.user) self.assertEqual(results, [])