1
0
mirror of https://github.com/httpie/cli.git synced 2025-06-15 00:15:06 +02:00

Handle empty passwords in URL credentials

Closes #242
This commit is contained in:
Jakub Roztocil
2014-07-18 13:38:33 +02:00
parent 0f96348fd1
commit ca36f1de04
3 changed files with 21 additions and 3 deletions

View File

@ -2,8 +2,9 @@
import requests
import pytest
from utils import http, add_auth, HTTP_OK
from utils import http, add_auth, HTTP_OK, TestEnvironment
import httpie.input
import httpie.cli
class TestAuth:
@ -44,3 +45,18 @@ class TestAuth:
r = http('--auth=user:password', 'GET', url)
assert HTTP_OK in r
assert r.json == {'authenticated': True, 'user': 'user'}
@pytest.mark.parametrize('url', [
'username@example.org',
'username:@example.org',
])
def test_only_username_in_url(self, url):
"""
https://github.com/jakubroztocil/httpie/issues/242
"""
args = httpie.cli.parser.parse_args(args=[url], env=TestEnvironment())
assert args.auth
assert args.auth.key == 'username'
assert args.auth.value == ''