'Test: Message catalog from FakeTranslation should return required translations.'

@mock.patch('django.utils.translation.ugettext', mock.Mock(return_value='XYZ-TEST-LANGUAGE'))
def test_message_catalog_translations(self):

    _translator = FakeTranslations.translator({'es': {'Hello': 'es-hello-world'}, 'fr': {'Hello': 'fr-hello-world'}})
    localedir = '/translations'
    translation.activate('es')
    with mock.patch('gettext.translation', return_value=_translator(domain='text', localedir=localedir, languages=[get_language()])):
        i18n_service = self.get_module_i18n_service(self.descriptor)
        self.assertEqual(i18n_service.ugettext('Hello'), 'es-hello-world')
    translation.activate('ar')
    with mock.patch('gettext.translation', return_value=_translator(domain='text', localedir=localedir, languages=[get_language()])):
        i18n_service = self.get_module_i18n_service(self.descriptor)
        self.assertEqual(i18n_service.ugettext('Hello'), 'Hello')
        self.assertNotEqual(i18n_service.ugettext('Hello'), 'fr-hello-world')
        self.assertNotEqual(i18n_service.ugettext('Hello'), 'es-hello-world')
    translation.activate('fr')
    with mock.patch('gettext.translation', return_value=_translator(domain='text', localedir=localedir, languages=[get_language()])):
        i18n_service = self.get_module_i18n_service(self.descriptor)
        self.assertEqual(i18n_service.ugettext('Hello'), 'fr-hello-world')
