From ac69d4311b51abd7905430dc669bbae3530286fe Mon Sep 17 00:00:00 2001 From: Michael Floering Date: Fri, 22 Jan 2016 18:37:30 -0600 Subject: [PATCH] add `-A` as short arg for `--auth-type` Addresses #430 comes with unit test --- httpie/cli.py | 2 +- tests/test_auth.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/httpie/cli.py b/httpie/cli.py index 2b05a883..24e8d77a 100644 --- a/httpie/cli.py +++ b/httpie/cli.py @@ -397,7 +397,7 @@ auth.add_argument( _auth_plugins = plugin_manager.get_auth_plugins() auth.add_argument( - '--auth-type', + '--auth-type', '-A', choices=[plugin.auth_type for plugin in _auth_plugins], default=_auth_plugins[0].auth_type, help=""" diff --git a/tests/test_auth.py b/tests/test_auth.py index 6d7cbb49..926a7900 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -14,11 +14,12 @@ class TestAuth: assert HTTP_OK in r assert r.json == {'authenticated': True, 'user': 'user'} + @pytest.mark.parametrize('argument_name', ['--auth-type', '-A']) @pytest.mark.skipif( requests.__version__ == '0.13.6', reason='Redirects with prefetch=False are broken in Requests 0.13.6') - def test_digest_auth(self, httpbin): - r = http('--auth-type=digest', '--auth=user:password', + def test_digest_auth(self, httpbin, argument_name): + r = http('{}=digest'.format(argument_name), '--auth=user:password', 'GET', httpbin.url + '/digest-auth/auth/user/password') assert HTTP_OK in r assert r.json == {'authenticated': True, 'user': 'user'}