diff --git a/tests/__init__.py b/tests/__init__.py index bc6264c9..cf2ec684 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1,4 @@ +# coding=utf-8 """Utilities used by HTTPie tests. """ diff --git a/tests/fixtures/__init__.py b/tests/fixtures/__init__.py index 2ffdf89f..ad6e9343 100644 --- a/tests/fixtures/__init__.py +++ b/tests/fixtures/__init__.py @@ -32,3 +32,5 @@ with codecs.open(JSON_FILE_PATH, encoding='utf8') as f: with open(BIN_FILE_PATH, 'rb') as f: BIN_FILE_CONTENT = f.read() + +UNICODE = FILE_CONTENT diff --git a/tests/fixtures/test.json b/tests/fixtures/test.json index 25d6347b..b5ea8840 100644 --- a/tests/fixtures/test.json +++ b/tests/fixtures/test.json @@ -1,4 +1,4 @@ { "name": "Jakub Roztočil", - "sun": "太陽" + "unicode": "χρυσαφὶ 太陽 เลิศ ♜♞♝♛♚♝♞♜ оживлённым तान्यहानि 有朋" } diff --git a/tests/fixtures/test.txt b/tests/fixtures/test.txt index f99b6ed7..21857443 100644 --- a/tests/fixtures/test.txt +++ b/tests/fixtures/test.txt @@ -1 +1 @@ -some UTF8-encoded unicode text 太陽 by Jakub Roztočil +[one line of UTF8-encoded unicode text] χρυσαφὶ 太陽 เลิศ ♜♞♝♛♚♝♞♜ оживлённым तान्यहानि 有朋 ஸ்றீனிவாஸ ٱلرَّحْمـَبنِ diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 7a71ed13..f9ca700f 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -4,6 +4,7 @@ import shutil from httpie.plugins.builtin import HTTPBasicAuth from tests import TestEnvironment, mk_config_dir, http, httpbin, HTTP_OK +from tests.fixtures import UNICODE class SessionTestBase(object): @@ -125,7 +126,6 @@ class TestSession(SessionTestBase): assert r2.json['headers']['Foo'] == 'Bar' def test_session_unicode(self): - UNICODE = u'太陽' r1 = http('--session=test', '--auth', u'test:' + UNICODE, 'GET', httpbin('/get'), u'Test:%s' % UNICODE, diff --git a/tests/test_unicode.py b/tests/test_unicode.py index 278e8316..58c39a7b 100644 --- a/tests/test_unicode.py +++ b/tests/test_unicode.py @@ -4,9 +4,7 @@ Various unicode handling related tests. """ from tests import http, httpbin, HTTP_OK - - -UNICODE = u'太陽' +from tests.fixtures import UNICODE class TestUnicode: