Files
opensearch-pyd/test_elasticsearch/test_client/test_utils.py
T

20 lines
651 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2014-05-29 01:16:17 +02:00
from __future__ import unicode_literals
from elasticsearch.client.utils import _make_path
2014-05-29 01:16:17 +02:00
from elasticsearch.compat import PY2
2013-08-28 19:11:28 +02:00
from ..test_cases import TestCase, SkipTest
class TestMakePath(TestCase):
def test_handles_unicode(self):
2014-05-29 01:16:17 +02:00
id = "中文"
self.assertEquals('/some-index/type/%E4%B8%AD%E6%96%87', _make_path('some-index', 'type', id))
def test_handles_utf_encoded_string(self):
2014-02-21 16:53:56 +01:00
if not PY2:
raise SkipTest('Only relevant for py2')
2014-05-29 01:16:17 +02:00
id = "中文".encode('utf-8')
self.assertEquals('/some-index/type/%E4%B8%AD%E6%96%87', _make_path('some-index', 'type', id))