You've already forked httpie-cli
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:
+12
-3
@@ -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"}}}'
|
||||
|
||||
Reference in New Issue
Block a user