diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-04-04 14:39:30 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-04-04 14:39:30 +0000 |
| commit | af25c217e9953e2e7b1c4e392a583e6fda653881 (patch) | |
| tree | 7f79e4d336757f62550d4ae9575ce87c63e2768a /tests | |
| parent | 1d1e4cd6d94d1729c86ad52f5d32b630198fe9bf (diff) | |
| parent | d8b66c7c1bb28672402f2bf1e410a1ee8fc4bfb6 (diff) | |
| download | oslo-af25c217e9953e2e7b1c4e392a583e6fda653881.tar.gz oslo-af25c217e9953e2e7b1c4e392a583e6fda653881.tar.xz oslo-af25c217e9953e2e7b1c4e392a583e6fda653881.zip | |
Merge "Add a gettextutils.install() helper function"
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_gettext.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/unit/test_gettext.py b/tests/unit/test_gettext.py index cedc25c..3a86782 100644 --- a/tests/unit/test_gettext.py +++ b/tests/unit/test_gettext.py @@ -17,7 +17,9 @@ import logging -from openstack.common.gettextutils import _ +import mock + +from openstack.common import gettextutils from tests import utils @@ -27,4 +29,16 @@ LOG = logging.getLogger(__name__) class GettextTest(utils.BaseTestCase): def test_gettext_does_not_blow_up(self): - LOG.info(_('test')) + LOG.info(gettextutils._('test')) + + def test_gettext_install_looks_up_localedir(self): + with mock.patch('os.environ.get') as environ_get: + with mock.patch('gettext.install') as gettext_install: + environ_get.return_value = '/foo/bar' + + gettextutils.install('blaa') + + environ_get.assert_called_once_with('BLAA_LOCALEDIR') + gettext_install.assert_called_once_with('blaa', + localedir='/foo/bar', + unicode=True) |
