mirror of
https://github.com/httpie/cli.git
synced 2025-08-16 01:08:01 +02:00
Modernize the code base with f-strings in tests (#1069)
Simple concatenations were kept for readability purpose.
This commit is contained in:
committed by
GitHub
parent
0ff0874fa3
commit
264d45cdf5
@ -36,7 +36,7 @@ class TestItemParsing:
|
||||
self.key_value_arg(r'baz\=bar=foo'),
|
||||
|
||||
# files
|
||||
self.key_value_arg(r'bar\@baz@%s' % FILE_PATH_ARG),
|
||||
self.key_value_arg(fr'bar\@baz@{FILE_PATH_ARG}'),
|
||||
])
|
||||
# `requests.structures.CaseInsensitiveDict` => `dict`
|
||||
headers = dict(items.headers._store.values())
|
||||
@ -148,16 +148,16 @@ class TestQuerystring:
|
||||
path = '/get?a=1&b=2'
|
||||
url = httpbin.url + path
|
||||
assert HTTP_OK in r
|
||||
assert 'GET %s HTTP/1.1' % path in r
|
||||
assert '"url": "%s"' % url in r
|
||||
assert f'GET {path} HTTP/1.1' in r
|
||||
assert f'"url": "{url}"' in r
|
||||
|
||||
def test_query_string_params_items(self, httpbin):
|
||||
r = http('--print=Hhb', 'GET', httpbin.url + '/get', 'a==1')
|
||||
path = '/get?a=1'
|
||||
url = httpbin.url + path
|
||||
assert HTTP_OK in r
|
||||
assert 'GET %s HTTP/1.1' % path in r
|
||||
assert '"url": "%s"' % url in r
|
||||
assert f'GET {path} HTTP/1.1' in r
|
||||
assert f'"url": "{url}"' in r
|
||||
|
||||
def test_query_string_params_in_url_and_items_with_duplicates(self,
|
||||
httpbin):
|
||||
@ -166,8 +166,8 @@ class TestQuerystring:
|
||||
path = '/get?a=1&a=1&a=1&a=1'
|
||||
url = httpbin.url + path
|
||||
assert HTTP_OK in r
|
||||
assert 'GET %s HTTP/1.1' % path in r
|
||||
assert '"url": "%s"' % url in r
|
||||
assert f'GET {path} HTTP/1.1' in r
|
||||
assert f'"url": "{url}"' in r
|
||||
|
||||
|
||||
class TestLocalhostShorthand:
|
||||
@ -347,9 +347,9 @@ class TestSchemes:
|
||||
http('bah', '--default=scheme=foo+bar-BAZ.123')
|
||||
|
||||
def test_default_scheme_option(self, httpbin_secure):
|
||||
url = '{0}:{1}'.format(httpbin_secure.host, httpbin_secure.port)
|
||||
url = f'{httpbin_secure.host}:{httpbin_secure.port}'
|
||||
assert HTTP_OK in http(url, '--default-scheme=https')
|
||||
|
||||
def test_scheme_when_invoked_as_https(self, httpbin_secure):
|
||||
url = '{0}:{1}'.format(httpbin_secure.host, httpbin_secure.port)
|
||||
url = f'{httpbin_secure.host}:{httpbin_secure.port}'
|
||||
assert HTTP_OK in http(url, program_name='https')
|
||||
|
Reference in New Issue
Block a user