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

Added tests for --quiet flag

This commit is contained in:
Nicolas Beltran
2020-06-27 11:08:44 -05:00
committed by Jakub Roztocil
parent a4a1e8d43b
commit 4bd2e622a5
4 changed files with 29 additions and 10 deletions

View File

@@ -189,3 +189,11 @@ class TestDownloads:
assert os.listdir('.') == [expected_filename]
finally:
os.chdir(orig_cwd)
def test_download_quietflag(self, httpbin_both, httpbin):
robots_txt = '/robots.txt'
body = urlopen(httpbin + robots_txt).read().decode()
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
r = http('--quiet', '--download', httpbin_both.url + robots_txt, env=env)
assert r.stderr == ''
assert body == r

View File

@@ -32,6 +32,15 @@ def test_output_option(httpbin, stdout_isatty):
assert actual_body == expected_body
class TestQuietFlag:
def test_quiet(self, httpbin):
r = http('--quiet', 'GET', httpbin.url + '/get')
# check stdin
assert r.stderr == ''
# Check stdout
assert str(r) == ''
class TestVerboseFlag:
def test_verbose(self, httpbin):
r = http('--verbose',