Added a testcase for the reflang feature.

This commit is contained in:
Virgil Dupras 2013-04-19 09:11:50 -04:00
parent ba6aa9d37e
commit 2b2c5772c4
2 changed files with 52 additions and 0 deletions

View file

@ -552,6 +552,21 @@ class RosettaTestCase(TestCase):
# Restore setting to default
settings.ROSETTA_ACCESS_CONTROL_FUNCTION = None
def test_25_reflang(self):
rosetta_settings.ENABLE_REFLANG = True
shutil.copy(os.path.normpath(os.path.join(self.curdir, './django.po.issue60.template')), self.dest_file)
self.client.get(reverse('rosetta-pick-file') + '?filter=third-party')
r = self.client.get(reverse('rosetta-language-selection', args=('xx', 0), kwargs=dict()))
r = self.client.get(reverse('rosetta-home'))
# Verify that there's an option to select a reflang
self.assertTrue('<option value="/rosetta/select-ref/xx/">dummy language</option>' in str(r.content))
r = self.client.get('/rosetta/select-ref/xx/')
r = self.client.get(reverse('rosetta-home'))
# The translated string in the test PO file ends up in the "Reference" column
self.assertTrue('<span class="message">translated-string1</span>' in str(r.content))
# Stubbed access control function
def no_access(user):

View file

@ -0,0 +1,37 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Rosetta\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-10-21 12:21+0200\n"
"PO-Revision-Date: 2008-09-22 11:02\n"
"Last-Translator: Admin Admin <admin@admin.com>\n"
"Language-Team: French <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Translated-Using: django-rosetta 0.4.RC2\n"
msgid "String 1"
msgstr "translated-string1"
msgid "String 2"
msgstr ""
#. Translators: This is a text of the base template
#: templates/base.html:43
msgid "String 3 with comment"
msgstr ""
msgctxt "Context hint"
msgid "String 4"
msgstr ""