diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-04-25 00:02:12 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-04-25 00:02:12 +0000 |
| commit | 7534bae0c5eeb34a0146e76a81a9312797f6ba5c (patch) | |
| tree | 15d3fd388eb3c5538c50da20c3691a9f39ca6de3 /repoze/bfg/tests/test_zcml.py | |
| parent | 51981a128c7ed05e51938a3f358c0970dcc33a6f (diff) | |
| download | pyramid-7534bae0c5eeb34a0146e76a81a9312797f6ba5c.tar.gz pyramid-7534bae0c5eeb34a0146e76a81a9312797f6ba5c.tar.bz2 pyramid-7534bae0c5eeb34a0146e76a81a9312797f6ba5c.zip | |
Merge i18n branch via svn merge --ignore-ancestry -r9030:9150 $REPOZE_SVN/repoze.bfg/branches/i18n
No foreigners were harmed in the coding of this feature.
Diffstat (limited to 'repoze/bfg/tests/test_zcml.py')
| -rw-r--r-- | repoze/bfg/tests/test_zcml.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_zcml.py b/repoze/bfg/tests/test_zcml.py index 7f42e9f09..5fdf25f33 100644 --- a/repoze/bfg/tests/test_zcml.py +++ b/repoze/bfg/tests/test_zcml.py @@ -1041,6 +1041,56 @@ class TestUtilityDirective(unittest.TestCase): self.assertEqual(utility['args'], (component, IFactory, '', None)) self.assertEqual(utility['kw'], {}) +class TestTranslationDirDirective(unittest.TestCase): + def setUp(self): + testing.setUp() + + def tearDown(self): + testing.tearDown() + + def _callFUT(self, *arg, **kw): + from repoze.bfg.zcml import translationdir + return translationdir(*arg, **kw) + + def test_it(self): + from repoze.bfg.configuration import Configurator + context = DummyContext() + tdir = 'repoze.bfg.tests.fixtures:locale' + self._callFUT(context, tdir) + actions = context.actions + self.assertEqual(len(actions), 1) + action = context.actions[0] + self.assertEqual(action['discriminator'], ('tdir', tdir)) + self.assertEqual(action['callable'].im_func, + Configurator.add_translation_dirs.im_func) + self.assertEqual(action['args'], (tdir,)) + action['callable'](*action['args']) # doesn't blow up + +class TestLocaleNegotiatorDirective(unittest.TestCase): + def setUp(self): + testing.setUp() + + def tearDown(self): + testing.tearDown() + + def _callFUT(self, *arg, **kw): + from repoze.bfg.zcml import localenegotiator + return localenegotiator(*arg, **kw) + + def test_it(self): + from repoze.bfg.configuration import Configurator + context = DummyContext() + dummy_negotiator = object() + self._callFUT(context, dummy_negotiator) + actions = context.actions + self.assertEqual(len(actions), 1) + action = context.actions[0] + self.assertEqual(action['discriminator'], 'lnegotiator') + self.assertEqual(action['callable'].im_func, + Configurator.set_locale_negotiator.im_func) + self.assertEqual(action['args'], (dummy_negotiator,)) + action['callable'](*action['args']) # doesn't blow up + class TestLoadZCML(unittest.TestCase): def setUp(self): testing.setUp() |
