Aesthetic changes

This commit is contained in:
Nicolas Beltran
2020-07-14 17:21:57 -05:00
committed by Jakub Roztocil
parent 7e38f9ccf0
commit 69e1067a2c
4 changed files with 20 additions and 17 deletions

View File

@ -2,7 +2,7 @@ import argparse
import mock
import json
import os
import io
import io
from tempfile import gettempdir
from urllib.request import urlopen
@ -54,18 +54,18 @@ class TestQuietFlag:
assert env.stdout == env.devnull
assert env.stderr == env.devnull
assert r.stderr == ''
assert HTTP_OK in r.devnull.decode()
assert HTTP_OK in r.devnull
assert str(r) == ''
@mock.patch('httpie.cli.argtypes.AuthCredentials._getpass',
new=lambda self, prompt:'password')
new=lambda self, prompt: 'password')
def test_quiet_password_prompt(self, httpbin):
""" Tests whether httpie still prompts for password when request
requires authetication and only username is provided"""
env = MockEnvironment(stdin_isatty=True, stdout_isatty=True)
env.devnull = io.BytesIO()
r = http('--quiet', '--auth', 'user','GET', httpbin.url + '/basic-auth/user/password', env=env)
assert HTTP_OK in r.devnull.decode()
r = http('--quiet', '--auth', 'user', 'GET', httpbin.url + '/basic-auth/user/password', env=env)
assert HTTP_OK in r.devnull
assert env.stdout == env.devnull
assert env.stderr == env.devnull
assert str(r) == ''
@ -80,6 +80,7 @@ class TestQuietFlag:
assert str(r) == ''
assert r.stderr == ''
class TestVerboseFlag:
def test_verbose(self, httpbin):
r = http('--verbose',