Ignore --download with --offline

This commit is contained in:
Jakub Roztocil 2020-04-16 11:41:12 +02:00
parent 770976a66e
commit 4351650691
2 changed files with 8 additions and 6 deletions

View File

@ -78,7 +78,7 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
# Arguments processing and environment setup.
self._apply_no_options(no_options)
self._validate_download_options()
self._process_download_options()
self._setup_standard_streams()
self._process_output_options()
self._process_pretty_options()
@ -379,7 +379,11 @@ class HTTPieArgumentParser(argparse.ArgumentParser):
# noinspection PyTypeChecker
self.args.prettify = PRETTY_MAP[self.args.prettify]
def _validate_download_options(self):
def _process_download_options(self):
if self.args.offline:
self.args.download = False
self.args.download_resume = False
return
if not self.args.download:
if self.args.download_resume:
self.error('--continue only works with --download')

View File

@ -187,9 +187,8 @@ def test_offline():
r = http(
'--offline',
'https://this-should.never-resolve/foo',
'param==value'
)
assert 'GET /foo?param=value' in r
assert 'GET /foo' in r
def test_offline_download():
@ -198,6 +197,5 @@ def test_offline_download():
'--offline',
'--download',
'https://this-should.never-resolve/foo',
'param==value'
)
assert 'GET /foo?param=value' in r
assert 'GET /foo' in r