mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 14:58:38 +00:00
Improve test case
This commit is contained in:
parent
b8ae666c78
commit
0e27dfd9c1
@ -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
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user