diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2013-08-05 09:42:34 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2013-08-05 09:42:34 (GMT) |
commit | 3f4d54c5bbd6acb49ed5b46f95db632be0c73fb7 (patch) | |
tree | 0e9dd2be0226a956dfc61cb89a28eb85888bba41 | |
parent | e02524a7d86a7213d115f141dd635b69c5492fc6 (diff) |
Test i18n queries from client side
-rw-r--r-- | TODO | 4 | ||||
-rwxr-xr-x | tests/units/client/routes.py | 39 |
2 files changed, 39 insertions, 4 deletions
@@ -1,7 +1,3 @@ -- 0.10 - - i18n searches - - rebuild SN repo to update "name" - - invalidate solutions cache on config changes (layers ans stabilities might be changed) - delete outdated impls on PUTing new one diff --git a/tests/units/client/routes.py b/tests/units/client/routes.py index c9caa7e..fcc355f 100755 --- a/tests/units/client/routes.py +++ b/tests/units/client/routes.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # sugar-lint: disable import json @@ -285,6 +286,44 @@ class RoutesTest(tests.Test): assert not self.node_volume['context'].exists(guid) self.assertEqual('title', call(cp, Request(method='GET', path=['context', guid, 'title']))) + def test_I18nQuery(self): + client.accept_language.value = 'foo' + self.start_online_client() + ipc = IPCConnection() + + guid1 = self.node_volume['context'].create({ + 'type': 'activity', + 'title': {'en-US': 'qwe', 'ru-RU': 'йцу'}, + 'summary': 'summary', + 'description': 'description', + }) + guid2 = self.node_volume['context'].create({ + 'type': 'activity', + 'title': {'en-US': 'qwerty', 'ru-RU': 'йцукен'}, + 'summary': 'summary', + 'description': 'description', + }) + + self.assertEqual([ + {'guid': guid1}, + {'guid': guid2}, + ], + ipc.get(['context'], query='йцу')['result']) + self.assertEqual([ + {'guid': guid1}, + {'guid': guid2}, + ], + ipc.get(['context'], query='qwe')['result']) + + self.assertEqual([ + {'guid': guid2}, + ], + ipc.get(['context'], query='йцукен')['result']) + self.assertEqual([ + {'guid': guid2}, + ], + ipc.get(['context'], query='qwerty')['result']) + def call(routes, request): router = Router(routes) |