Skip to content

Commit 396d8fa

Browse files
committed
parametrize target in def test_create_channel_implicit
1 parent d63402e commit 396d8fa

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

tests/asyncio/test_grpc_helpers_async.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,13 @@ def test_wrap_errors_streaming(wrap_stream_errors):
299299

300300

301301
@pytest.mark.parametrize(
302-
"attempt_direct_path,expected_target",
302+
"attempt_direct_path,target,expected_target",
303303
[
304-
(None, "example.com:443"),
305-
(False, "example.com:443"),
306-
(True, "google-c2p:///example.com"),
304+
(None, "example.com:443", "example.com:443"),
305+
(False, "example.com:443", "example.com:443"),
306+
(True, "example.com:443", "google-c2p:///example.com"),
307+
(True, "dns:///example.com", "google-c2p:///example.com"),
308+
(True, "another-c2p:///example.com", "another-c2p:///example.com"),
307309
],
308310
)
309311
@mock.patch("grpc.compute_engine_channel_credentials")
@@ -318,9 +320,9 @@ def test_create_channel_implicit(
318320
google_auth_default,
319321
composite_creds_call,
320322
attempt_direct_path,
323+
target,
321324
expected_target,
322325
):
323-
target = "example.com:443"
324326
composite_creds = composite_creds_call.return_value
325327

326328
channel = grpc_helpers_async.create_channel(

tests/unit/test_grpc_helpers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,13 @@ def test_wrap_errors_streaming(wrap_stream_errors):
366366

367367

368368
@pytest.mark.parametrize(
369-
"attempt_direct_path,expected_target",
369+
"attempt_direct_path,target,expected_target",
370370
[
371-
(None, "example.com:443"),
372-
(False, "example.com:443"),
373-
(True, "google-c2p:///example.com"),
371+
(None, "example.com:443", "example.com:443"),
372+
(False, "example.com:443", "example.com:443"),
373+
(True, "example.com:443", "google-c2p:///example.com"),
374+
(True, "dns:///example.com", "google-c2p:///example.com"),
375+
(True, "another-c2p:///example.com", "another-c2p:///example.com"),
374376
],
375377
)
376378
@mock.patch("grpc.compute_engine_channel_credentials")
@@ -385,9 +387,9 @@ def test_create_channel_implicit(
385387
google_auth_default,
386388
composite_creds_call,
387389
attempt_direct_path,
390+
target,
388391
expected_target,
389392
):
390-
target = "example.com:443"
391393
composite_creds = composite_creds_call.return_value
392394

393395
channel = grpc_helpers.create_channel(

0 commit comments

Comments
 (0)