Commit 80e5a610 by Andy Armstrong

Add --settings parameter for i18n_dummy task

parent a3f8cafb
......@@ -75,19 +75,24 @@ def i18n_generate_strict():
@task
@needs("pavelib.i18n.i18n_extract")
@cmdopts([
("settings=", "s", "The settings to use (defaults to devstack)"),
])
@timed
def i18n_dummy():
def i18n_dummy(options):
"""
Simulate international translation by generating dummy strings
corresponding to source strings.
"""
settings = options.get('settings', DEFAULT_SETTINGS)
sh("i18n_tool dummy")
# Need to then compile the new dummy strings
sh("i18n_tool generate")
# Generate static i18n JS files.
for system in ['lms', 'cms']:
sh(django_cmd(system, DEFAULT_SETTINGS, 'compilejsi18n'))
sh(django_cmd(system, settings, 'compilejsi18n'))
@task
......
......@@ -2,15 +2,16 @@
Tests for pavelib/i18n.py.
"""
import os
import textwrap
import unittest
from mock import mock_open, patch
from paver.easy import task
from paver.easy import task, call_task
import pavelib.i18n
from pavelib.paver_tests.utils import PaverTestCase
from pavelib.paver_tests.utils import PaverTestCase
TX_CONFIG_SIMPLE = """\
[main]
......@@ -132,3 +133,36 @@ class ReleasePushPullTest(PaverTestCase):
mock_sh.assert_called_once_with(
'i18n_tool transifex pull edx-platform.release-zebrawood edx-platform.release-zebrawood-js'
)
class TestI18nDummy(PaverTestCase):
"""
Test the Paver i18n_dummy task.
"""
def setUp(self):
super(TestI18nDummy, self).setUp()
# Mock the paver @needs decorator for i18n_extract
self._mock_paver_needs = patch.object(pavelib.i18n.i18n_extract, 'needs').start()
self._mock_paver_needs.return_value = 0
# Cleanup mocks
self.addCleanup(self._mock_paver_needs.stop)
def test_i18n_dummy(self):
"""
Test the "i18n_dummy" task.
"""
self.reset_task_messages()
os.environ['NO_PREREQ_INSTALL'] = "true"
call_task('pavelib.i18n.i18n_dummy', options={"settings": 'test'})
self.assertEquals(
self.task_messages,
[
u'i18n_tool extract',
u'i18n_tool dummy',
u'i18n_tool generate',
u'python manage.py lms --settings=test compilejsi18n',
u'python manage.py cms --settings=test compilejsi18n',
]
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment