Source code for backend.globaleaks.tests.handlers.test_l10n

# -*- coding: utf-8 -*-
from globaleaks.handlers import l10n
from globaleaks.handlers.admin import l10n as admin_l10n
from globaleaks.rest import errors
from globaleaks.tests import helpers
from twisted.internet.defer import inlineCallbacks

[docs]custom_texts = { '12345': '54321'
}
[docs]class TestL10NHandler(helpers.TestHandler):
[docs] _handler = l10n.L10NHandler
@inlineCallbacks
[docs] def test_get(self): handler = self.request() response = yield handler.get(u'unexistent') self.assertEqual(response, {}) handler = self.request() response = yield handler.get(lang=u'en') self.assertNotIn('12345', response) self._handler = admin_l10n.AdminL10NHandler handler = self.request(custom_texts, role='admin') yield handler.put(lang=u'en') self._handler = l10n.L10NHandler handler = self.request() response = yield handler.get(lang=u'en') self.assertIn('12345', response) self.assertEqual('54321', response['12345'])