Improve test case

This commit is contained in:
yonder 2016-03-04 11:12:03 -05:00
parent b8ae666c78
commit 0e27dfd9c1
2 changed files with 5 additions and 1 deletions

View File

@ -119,7 +119,7 @@ def parse_server_spec(url):
def parse_upstream_auth(auth):
pattern = re.compile(":")
pattern = re.compile(".+:")
if pattern.search(auth) is None:
raise configargparse.ArgumentTypeError(
"Invalid upstream auth specification: %s" % auth

View File

@ -56,8 +56,12 @@ def test_parse_server_spec():
def test_parse_upstream_auth():
tutils.raises("Invalid upstream auth specification", cmdline.parse_upstream_auth, "")
tutils.raises("Invalid upstream auth specification", cmdline.parse_upstream_auth, ":")
tutils.raises("Invalid upstream auth specification", cmdline.parse_upstream_auth, ":test")
assert cmdline.parse_upstream_auth(
"test:test") == "Basic" + " " + base64.b64encode("test:test")
assert cmdline.parse_upstream_auth(
"test:") == "Basic" + " " + base64.b64encode("test:")
def test_parse_setheaders():