예제 #1
0
파일: test_models.py 프로젝트: rlr/fjord
    def test_spanish_with_dennis_and_existing_translations(self):
        """Response should pick up existing translation"""
        existing_resp = ResponseFactory(
            locale=u'es',
            product=u'firefox',
            description=u'hola',
            translated_description=u'DUDE!'
        )

        resp = ResponseFactory(
            locale=u'es',
            product=u'firefox',
            description=u'hola',
            translated_description=u''
        )

        # Set the product up for translation *after* creating the response
        # so that it doesn't get auto-translated because Response is set up
        # for auto-translation.
        prod = Product.objects.get(db_name='firefox')
        prod.translation_system = u'dennis'
        prod.save()

        # No jobs should be translated
        eq_(len(resp.generate_translation_jobs()), 0)
        eq_(resp.translated_description, existing_resp.translated_description)
예제 #2
0
    def test_spanish_with_dennis_and_existing_translations(self):
        """Response should pick up existing translation"""
        existing_resp = ResponseFactory(
            locale=u'es',
            product=u'firefox',
            description=u'hola',
            translated_description=u'DUDE!'
        )

        resp = ResponseFactory(
            locale=u'es',
            product=u'firefox',
            description=u'hola',
            translated_description=u''
        )

        # Set the product up for translation *after* creating the response
        # so that it doesn't get auto-translated because Response is set up
        # for auto-translation.
        prod = Product.objects.get(db_name='firefox')
        prod.translation_system = u'dennis'
        prod.save()

        # No jobs should be translated
        assert len(resp.generate_translation_jobs()) == 0
        assert resp.translated_description == existing_resp.translated_description
예제 #3
0
파일: test_models.py 프로젝트: xrile/fjord
    def test_english_gb_no_translation(self):
        """en-GB descriptions should get copied over"""
        resp = ResponseFactory(locale=u'en-GB',
                               description=u'hello',
                               translated_description=u'')

        # No new jobs should be generated
        assert len(resp.generate_translation_jobs()) == 0

        # Re-fetch from the db and make sure the description was copied over
        resp = Response.objects.get(id=resp.id)
        assert resp.description == resp.translated_description
예제 #4
0
파일: test_models.py 프로젝트: xrile/fjord
    def test_spanish_no_translation(self):
        """Spanish should not get translated"""
        resp = ResponseFactory(locale=u'es',
                               product=u'firefox',
                               description=u'hola',
                               translated_description=u'')

        # No jobs should be translated
        assert len(resp.generate_translation_jobs()) == 0

        # Nothing should be translated
        assert resp.translated_description == u''
예제 #5
0
    def test_english_no_translation(self):
        """English descriptions should get copied over"""
        resp = ResponseFactory(locale=u'en-US',
                               description=u'hello',
                               translated_description=u'')

        # No new jobs should be generated
        eq_(len(resp.generate_translation_jobs()), 0)

        # Re-fetch from the db and make sure the description was copied over
        resp = Response.objects.get(id=resp.id)
        eq_(resp.description, resp.translated_description)
예제 #6
0
파일: test_models.py 프로젝트: rlr/fjord
    def test_spanish_no_translation(self):
        """Spanish should not get translated"""
        resp = ResponseFactory(
            locale=u'es',
            product=u'firefox',
            description=u'hola',
            translated_description=u''
        )

        # No jobs should be translated
        eq_(len(resp.generate_translation_jobs()), 0)

        # Nothing should be translated
        eq_(resp.translated_description, u'')
예제 #7
0
파일: test_models.py 프로젝트: rlr/fjord
    def test_english_gb_no_translation(self):
        """en-GB descriptions should get copied over"""
        resp = ResponseFactory(
            locale=u'en-GB',
            description=u'hello',
            translated_description=u''
        )

        # No new jobs should be generated
        eq_(len(resp.generate_translation_jobs()), 0)

        # Re-fetch from the db and make sure the description was copied over
        resp = Response.objects.get(id=resp.id)
        eq_(resp.description, resp.translated_description)
예제 #8
0
    def test_english_no_translation(self):
        """English descriptions should get copied over"""
        resp = ResponseFactory(
            locale=u'en-US',
            description=u'hello',
            translated_description=u''
        )

        # No new jobs should be generated
        assert len(resp.generate_translation_jobs()) == 0

        # Re-fetch from the db and make sure the description was copied over
        resp = Response.objects.get(id=resp.id)
        assert resp.description == resp.translated_description
예제 #9
0
파일: test_models.py 프로젝트: xrile/fjord
    def test_english_with_dennis(self):
        """English descriptions should get copied over"""
        resp = ResponseFactory(locale=u'en-US',
                               product=u'firefox',
                               description=u'hello',
                               translated_description=u'')

        # Set the product up for translation *after* creating the response
        # so that it doesn't get auto-translated because Response is set up
        # for auto-translation.
        prod = Product.objects.get(db_name='firefox')
        prod.translation_system = u'dennis'
        prod.save()

        # No new jobs should be generated
        assert len(resp.generate_translation_jobs()) == 0

        # Re-fetch from the db and make sure the description was copied over
        resp = Response.objects.get(id=resp.id)
        assert resp.description == resp.translated_description
예제 #10
0
파일: test_models.py 프로젝트: rlr/fjord
    def test_english_with_dennis(self):
        """English descriptions should get copied over"""
        resp = ResponseFactory(
            locale=u'en-US',
            product=u'firefox',
            description=u'hello',
            translated_description=u''
        )

        # Set the product up for translation *after* creating the response
        # so that it doesn't get auto-translated because Response is set up
        # for auto-translation.
        prod = Product.objects.get(db_name='firefox')
        prod.translation_system = u'dennis'
        prod.save()

        # No new jobs should be generated
        eq_(len(resp.generate_translation_jobs()), 0)

        # Re-fetch from the db and make sure the description was copied over
        resp = Response.objects.get(id=resp.id)
        eq_(resp.description, resp.translated_description)
예제 #11
0
파일: test_models.py 프로젝트: xrile/fjord
    def test_spanish_with_dennis(self):
        """Spanish should get translated"""
        resp = ResponseFactory(locale=u'es',
                               product=u'firefox',
                               description=u'hola',
                               translated_description=u'')

        # Set the product up for translation *after* creating the response
        # so that it doesn't get auto-translated because Response is set up
        # for auto-translation.
        prod = Product.objects.get(db_name='firefox')
        prod.translation_system = u'dennis'
        prod.save()

        # One job should be generated
        jobs = resp.generate_translation_jobs()
        assert len(jobs) == 1
        job = jobs[0]
        assert job[1:] == (u'dennis', u'es', u'description', u'en',
                           'translated_description')

        assert resp.translated_description == u''
예제 #12
0
파일: test_models.py 프로젝트: rlr/fjord
    def test_spanish_with_dennis(self):
        """Spanish should get translated"""
        resp = ResponseFactory(
            locale=u'es',
            product=u'firefox',
            description=u'hola',
            translated_description=u''
        )

        # Set the product up for translation *after* creating the response
        # so that it doesn't get auto-translated because Response is set up
        # for auto-translation.
        prod = Product.objects.get(db_name='firefox')
        prod.translation_system = u'dennis'
        prod.save()

        # One job should be generated
        jobs = resp.generate_translation_jobs()
        eq_(len(jobs), 1)
        job = jobs[0]
        eq_(job[1:], (u'dennis', u'es', u'description',
                      u'en', 'translated_description'))

        eq_(resp.translated_description, u'')