diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-02-16 12:14:27 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-02-16 12:14:27 +0000 |
| commit | fef575a7f927fd2b080abee63a600d333c26e52d (patch) | |
| tree | 8db392a007dd58cfc2c891eb524d54276f150569 /tests | |
| parent | 71da5f62dab825e015864fd5604be46815e24ff1 (diff) | |
Fixed #6380 - Follow symlinks when examining source code and templates for translation strings.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/makemessages/templates/test.html | 2 | ||||
| -rw-r--r-- | tests/regressiontests/makemessages/tests.py | 31 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/regressiontests/makemessages/templates/test.html b/tests/regressiontests/makemessages/templates/test.html new file mode 100644 index 0000000000..2c38b3e4e6 --- /dev/null +++ b/tests/regressiontests/makemessages/templates/test.html @@ -0,0 +1,2 @@ +{% load i18n %} +{% trans "This literal should be included." %}
\ No newline at end of file diff --git a/tests/regressiontests/makemessages/tests.py b/tests/regressiontests/makemessages/tests.py index 954daf6a41..84eed2edeb 100644 --- a/tests/regressiontests/makemessages/tests.py +++ b/tests/regressiontests/makemessages/tests.py @@ -40,3 +40,34 @@ class JavascriptExtractorTests(ExtractorTests): po_contents = open(self.PO_FILE, 'r').read() self.assertMsgId('This literal should be included.', po_contents) self.assertMsgId('This one as well.', po_contents) + +class SymlinkExtractorTests(ExtractorTests): + + PO_FILE='locale/%s/LC_MESSAGES/django.po' % LOCALE + + def setUp(self): + self._cwd = os.getcwd() + self.test_dir = os.path.abspath(os.path.dirname(__file__)) + self.symlinked_dir = os.path.join(self.test_dir, 'templates_symlinked') + + def tearDown(self): + super(SymlinkExtractorTests, self).tearDown() + os.chdir(self.test_dir) + try: + os.remove(self.symlinked_dir) + except OSError: + pass + os.chdir(self._cwd) + + def test_symlink(self): + if hasattr(os, 'symlink'): + if os.path.exists(self.symlinked_dir): + self.assert_(os.path.islink(self.symlinked_dir)) + else: + os.symlink(os.path.join(self.test_dir, 'templates'), self.symlinked_dir) + os.chdir(self.test_dir) + management.call_command('makemessages', locale=LOCALE, verbosity=0, symlinks=True) + self.assert_(os.path.exists(self.PO_FILE)) + po_contents = open(self.PO_FILE, 'r').read() + self.assertMsgId('This literal should be included.', po_contents) + self.assert_('templates_symlinked/test.html' in po_contents) |
