@@ -104,17 +104,10 @@ def test_load_certs_returns_bytes():
104104 assert isinstance (_load_certs (), bytes )
105105
106106
107- def test_parse_target_handles_http_prefix ():
108- """Check that parse_target raises an error when the target contains http ://."""
107+ def test_parse_target_handles_ftp_prefix ():
108+ """Check that parse_target raises an error when the target contains ftp ://."""
109109 with pytest .raises (ValueError ):
110- parse_target ("http://localhost:8081" )
111-
112-
113- def test_parse_target_handles_https_prefix ():
114- """Check that parse_target raises an error when the target contains https://."""
115- with pytest .raises (ValueError ):
116- parse_target ("https://localhost:8081" )
117-
110+ parse_target ("ftp://localhost:8081" )
118111
119112def test_parse_target_parses_authority_correctly ():
120113 """Check that parse_target parses the authority correctly."""
@@ -127,6 +120,12 @@ def test_parse_target_parses_authority_correctly():
127120def test_parse_target_adds_default_port_if_missing ():
128121 """Check that parse_target adds the default port if missing."""
129122 authority , _ , _ = parse_target ("grpc://localhost" )
123+ assert authority == "localhost:80"
124+ authority , _ , _ = parse_target ("http://localhost" )
125+ assert authority == "localhost:80"
126+ authority , _ , _ = parse_target ("grpcs://localhost" )
127+ assert authority == "localhost:443"
128+ authority , _ , _ = parse_target ("https://localhost" )
130129 assert authority == "localhost:443"
131130
132131
@@ -144,8 +143,14 @@ def test_parse_target_handles_no_path():
144143
145144def test_parse_target_parses_tls_verify_correctly ():
146145 """Check that parse_target parses tls_verify correctly."""
146+ _ , _ , tls_verify = parse_target ("grpc://localhost:8081" )
147+ assert tls_verify is False
148+ _ , _ , tls_verify = parse_target ("http://localhost:8081" )
149+ assert tls_verify is False
147150 _ , _ , tls_verify = parse_target ("grpcs://localhost:8081" )
148151 assert tls_verify is True
152+ _ , _ , tls_verify = parse_target ("https://localhost:8081" )
153+ assert tls_verify is True
149154
150155
151156def test_get_sentry_dsn_returns_env_var_when_no_input ():
0 commit comments