1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Use : instead of = in `--format-options

This commit is contained in:
Jakub Roztocil
2020-05-28 12:26:06 +02:00
parent aae596d472
commit caeef2fb7c
6 changed files with 19 additions and 18 deletions

View File

@@ -182,7 +182,7 @@ class TestFormatOptions:
def get_headers(sort):
return http(
'--offline', '--print=H',
'--format-options', 'headers.sort=' + sort,
'--format-options', 'headers.sort:' + sort,
'example.org', 'ZZZ:foo', 'XXX:foo',
)
@@ -197,15 +197,15 @@ class TestFormatOptions:
argvalues=[
# @formatter:off
(
'json.sort_keys=true,json.indent=4',
'json.sort_keys:true,json.indent:4',
json.dumps({'a': 0, 'b': 0}, indent=4),
),
(
'json.sort_keys=false,json.indent=2',
'json.sort_keys:false,json.indent:2',
json.dumps({'b': 0, 'a': 0}, indent=2),
),
(
'json.format=false',
'json.format:false',
json.dumps({'b': 0, 'a': 0}),
),
# @formatter:on
@@ -223,9 +223,9 @@ class TestFormatOptions:
argnames=['defaults', 'options_string', 'expected'],
argvalues=[
# @formatter:off
({'foo': {'bar': 1}}, 'foo.bar=2', {'foo': {'bar': 2}}),
({'foo': {'bar': True}}, 'foo.bar=false', {'foo': {'bar': False}}),
({'foo': {'bar': 'a'}}, 'foo.bar=b', {'foo': {'bar': 'b'}}),
({'foo': {'bar': 1}}, 'foo.bar:2', {'foo': {'bar': 2}}),
({'foo': {'bar': True}}, 'foo.bar:false', {'foo': {'bar': False}}),
({'foo': {'bar': 'a'}}, 'foo.bar:b', {'foo': {'bar': 'b'}}),
# @formatter:on
]
)
@@ -236,9 +236,9 @@ class TestFormatOptions:
@pytest.mark.parametrize(
argnames=['options_string', 'expected_error'],
argvalues=[
('foo=2', 'invalid option'),
('foo.baz=2', 'invalid key'),
('foo.bar=false', 'expected int got bool'),
('foo:2', 'invalid option'),
('foo.baz:2', 'invalid key'),
('foo.bar:false', 'expected int got bool'),
]
)
def test_parse_format_options_errors(self, options_string, expected_error):

View File

@@ -216,6 +216,7 @@ def http(
add_to_args.append('--timeout=3')
complete_args = [program_name, *add_to_args, *args]
# print(' '.join(complete_args))
def dump_stderr():
stderr.seek(0)