Added a test that verifies .netrc is honored when only --auth-type is passed

This commit is contained in:
Nicolas Beltran authored and Jakub Roztocil committed 2020-06-16 10:07:41 +02:00
1 parent 26e29612f2
commit c240162cab
1 file changed
+8 -1
+8 -1
View File
@@ -15,7 +15,6 @@ def test_basic_auth(httpbin_both):
assert HTTP_OK in r
assert r.json == {'authenticated': True, 'user': 'user'}
@pytest.mark.parametrize('argument_name', ['--auth-type', '-A'])
def test_digest_auth(httpbin_both, argument_name):
r = http(argument_name + '=digest', '--auth=user:password',
@@ -107,3 +106,11 @@ def test_ignore_netrc_together_with_auth():
env=MockEnvironment(),
)
assert isinstance(args.auth, HTTPBasicAuth)
def test_honor_netrc_authtype(httpbin_both):
with mock.patch('requests.sessions.get_netrc_auth') as get_netrc_auth:
get_netrc_auth.return_value = ('httpie', 'password')
r = http('--auth-type=basic','GET', httpbin_both + '/basic-auth/httpie/password')
assert get_netrc_auth.call_count == 1
assert HTTP_OK in r