MCPcopy
hub / github.com/httpie/cli / test_escape_separator

Method test_escape_separator

tests/test_cli.py:30–52  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

28 pytest.raises(argparse.ArgumentTypeError, self.key_value_arg, item)
29
30 def test_escape_separator(self):
31 items = RequestItems.from_args([
32 # headers
33 self.key_value_arg(r'foo\:bar:baz'),
34 self.key_value_arg(r'jack\@jill:hill'),
35
36 # data
37 self.key_value_arg(r'baz\=bar=foo'),
38
39 # files
40 self.key_value_arg(fr'bar\@baz@{FILE_PATH_ARG}'),
41 ])
42 # `HTTPHeadersDict` => `dict`
43 headers = dict(items.headers)
44
45 assert headers == {
46 'foo:bar': 'baz',
47 'jack@jill': 'hill',
48 }
49 assert items.data == {
50 'baz=bar': 'foo'
51 }
52 assert 'bar@baz' in items.files
53
54 @pytest.mark.parametrize('string, key, sep, value', [
55 ('path=c:\\windows', 'path', '=', 'c:\\windows'),

Callers

nothing calls this directly

Calls 1

from_argsMethod · 0.80

Tested by

no test coverage detected