mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 19:45:42 +02:00
Refactoring
This commit is contained in:
@ -5,8 +5,8 @@ import pytest
|
||||
from httpie.plugins.builtin import HTTPBasicAuth
|
||||
from httpie.utils import ExplicitNullAuth
|
||||
from utils import http, add_auth, HTTP_OK, MockEnvironment
|
||||
import httpie.input
|
||||
import httpie.cli
|
||||
import httpie.cli.constants
|
||||
import httpie.cli.definition
|
||||
|
||||
|
||||
def test_basic_auth(httpbin_both):
|
||||
@ -24,7 +24,7 @@ def test_digest_auth(httpbin_both, argument_name):
|
||||
assert r.json == {'authenticated': True, 'user': 'user'}
|
||||
|
||||
|
||||
@mock.patch('httpie.input.AuthCredentials._getpass',
|
||||
@mock.patch('httpie.cli.argtypes.AuthCredentials._getpass',
|
||||
new=lambda self, prompt: 'password')
|
||||
def test_password_prompt(httpbin):
|
||||
r = http('--auth', 'user',
|
||||
@ -60,7 +60,7 @@ def test_only_username_in_url(url):
|
||||
https://github.com/jakubroztocil/httpie/issues/242
|
||||
|
||||
"""
|
||||
args = httpie.cli.parser.parse_args(args=[url], env=MockEnvironment())
|
||||
args = httpie.cli.definition.parser.parse_args(args=[url], env=MockEnvironment())
|
||||
assert args.auth
|
||||
assert args.auth.username == 'username'
|
||||
assert args.auth.password == ''
|
||||
@ -94,7 +94,7 @@ def test_ignore_netrc(httpbin_both):
|
||||
|
||||
|
||||
def test_ignore_netrc_null_auth():
|
||||
args = httpie.cli.parser.parse_args(
|
||||
args = httpie.cli.definition.parser.parse_args(
|
||||
args=['--ignore-netrc', 'example.org'],
|
||||
env=MockEnvironment(),
|
||||
)
|
||||
@ -102,7 +102,7 @@ def test_ignore_netrc_null_auth():
|
||||
|
||||
|
||||
def test_ignore_netrc_together_with_auth():
|
||||
args = httpie.cli.parser.parse_args(
|
||||
args = httpie.cli.definition.parser.parse_args(
|
||||
args=['--ignore-netrc', '--auth=username:password', 'example.org'],
|
||||
env=MockEnvironment(),
|
||||
)
|
||||
|
Reference in New Issue
Block a user