1
0
mirror of https://github.com/httpie/cli.git synced 2026-04-24 19:53:55 +02:00

Work around missing object_pairs_hook in Python 2.6

This commit is contained in:
Jakub Roztocil
2015-01-23 22:04:42 +01:00
parent 22c993bab8
commit 25b1be7c8a
4 changed files with 32 additions and 14 deletions
+12 -3
View File
@@ -1,7 +1,10 @@
"""High-level tests."""
import pytest
from utils import TestEnvironment, http, HTTP_OK
from fixtures import FILE_PATH, FILE_CONTENT
import httpie
from httpie.compat import is_py26
class TestHTTPie:
@@ -64,7 +67,13 @@ class TestHTTPie:
assert '"User-Agent": "HTTPie' in r, r
assert '"Foo": "bar"' in r
def test_json_order(self, httpbin):
r = http('PATCH', httpbin.url + '/patch', 'order:={"map":{"1":"first","2":"second"}}')
@pytest.mark.skipif(
is_py26,
reason='the `object_pairs_hook` arg for `json.loads()` is Py>2.6 only'
)
def test_json_input_preserve_order(self, httpbin):
r = http('PATCH', httpbin.url + '/patch',
'order:={"map":{"1":"first","2":"second"}}')
assert HTTP_OK in r
assert r.json['data'] == '{"order": {"map": {"1": "first", "2": "second"}}}'
assert r.json['data'] == \
'{"order": {"map": {"1": "first", "2": "second"}}}'