[Zope3-checkins] CVS: Zope3/src/zope/app/i18n/tests - testi18ndirectives.py:1.8

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 8 18:36:27 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/i18n/tests
In directory cvs.zope.org:/tmp/cvs-serv5525/src/zope/app/i18n/tests

Modified Files:
	testi18ndirectives.py 
Log Message:


Adjusted code to the new API. Also renamed 'gts' namespace to 'i18n'. I wanted
to do this for a very long time.


=== Zope3/src/zope/app/i18n/tests/testi18ndirectives.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/i18n/tests/testi18ndirectives.py:1.7	Thu Nov 27 08:59:20 2003
+++ Zope3/src/zope/app/i18n/tests/testi18ndirectives.py	Mon Mar  8 18:36:27 2004
@@ -21,51 +21,38 @@
 from zope.component.tests.placelesssetup import PlacelessSetup
 from zope.configuration import xmlconfig
 
+from zope.app import zapi
+from zope.i18n.interfaces import ITranslationDomain
 import zope.app.i18n
 import zope.i18n.tests
 
-from zope.i18n.globaltranslationservice import translationService
-
-
 template = """<configure
    xmlns='http://namespaces.zope.org/zope'
-   xmlns:gts='http://namespaces.zope.org/gts'>
-   xmlns:test='http://www.zope.org/NS/Zope3/test'>
+   xmlns:i18n='http://namespaces.zope.org/i18n'>
    %s
    </configure>"""
 
 
 class DirectivesTest(PlacelessSetup, unittest.TestCase):
 
-    # XXX: tests for other directives needed
-
     def setUp(self):
         super(DirectivesTest, self).setUp()
         self.context = xmlconfig.file('meta.zcml', zope.app.i18n)
 
     def testRegisterTranslations(self):
         eq = self.assertEqual
-        eq(translationService._catalogs, {})
+        eq(zapi.queryUtility(None, ITranslationDomain), None)
         xmlconfig.string(
             template % '''
             <configure package="zope.i18n.tests">
-            <gts:registerTranslations directory="./locale" />
+            <i18n:registerTranslations directory="./locale" />
             </configure>
             ''', self.context)
         path = os.path.join(os.path.dirname(zope.i18n.tests.__file__),
                             'locale', 'en',
                             'LC_MESSAGES', 'zope-i18n.mo')
-        eq(translationService._catalogs,
-           {('en', 'zope-i18n'): [unicode(path)]})
-
-    def testDefaultLanguages(self):
-        eq = self.assertEqual
-        eq(translationService._fallbacks, ['en'])
-        xmlconfig.string(
-            template % '''
-            <gts:defaultLanguages languages="de nl xx" />
-            ''', self.context)
-        eq(translationService._fallbacks, ['de', 'nl', 'xx'])
+        util = zapi.getUtility(None, ITranslationDomain, name='zope-i18n')
+        eq(util._catalogs, {'en': [unicode(path)]})
 
 
 def test_suite():




More information about the Zope3-Checkins mailing list