Skip to content

Commit b39ffad

Browse files
committed
Updating unit tests
Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com>
1 parent 877dabb commit b39ffad

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

durabletask/internal/shared.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def get_default_host_address() -> str:
2424

2525
def get_grpc_channel(
2626
host_address: Optional[str],
27-
metadata: Optional[list[tuple[str, str]]] = None,
2827
secure_channel: bool = False,
2928
interceptors: Optional[list[DefaultClientInterceptorImpl]] = None) -> grpc.Channel:
3029

tests/test_client.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66

77
HOST_ADDRESS = 'localhost:50051'
88
METADATA = [('key1', 'value1'), ('key2', 'value2')]
9-
9+
INTERCEPTORS = DefaultClientInterceptorImpl(METADATA)
1010

1111
def test_get_grpc_channel_insecure():
1212
with patch('grpc.insecure_channel') as mock_channel:
13-
get_grpc_channel(HOST_ADDRESS, METADATA, False)
13+
get_grpc_channel(HOST_ADDRESS, False, interceptors=INTERCEPTORS)
1414
mock_channel.assert_called_once_with(HOST_ADDRESS)
1515

1616

1717
def test_get_grpc_channel_secure():
1818
with patch('grpc.secure_channel') as mock_channel, patch(
1919
'grpc.ssl_channel_credentials') as mock_credentials:
20-
get_grpc_channel(HOST_ADDRESS, METADATA, True)
20+
get_grpc_channel(HOST_ADDRESS, True, interceptors=INTERCEPTORS)
2121
mock_channel.assert_called_once_with(HOST_ADDRESS, mock_credentials.return_value)
2222

2323

2424
def test_get_grpc_channel_default_host_address():
2525
with patch('grpc.insecure_channel') as mock_channel:
26-
get_grpc_channel(None, METADATA, False)
26+
get_grpc_channel(None, False, interceptors=INTERCEPTORS)
2727
mock_channel.assert_called_once_with(get_default_host_address())
2828

2929

3030
def test_get_grpc_channel_with_metadata():
3131
with patch('grpc.insecure_channel') as mock_channel, patch(
3232
'grpc.intercept_channel') as mock_intercept_channel:
33-
get_grpc_channel(HOST_ADDRESS, METADATA, False)
33+
get_grpc_channel(HOST_ADDRESS, False, interceptors=INTERCEPTORS)
3434
mock_channel.assert_called_once_with(HOST_ADDRESS)
3535
mock_intercept_channel.assert_called_once()
3636

@@ -48,41 +48,41 @@ def test_grpc_channel_with_host_name_protocol_stripping():
4848
host_name = "myserver.com:1234"
4949

5050
prefix = "grpc://"
51-
get_grpc_channel(prefix + host_name, METADATA)
51+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
5252
mock_insecure_channel.assert_called_with(host_name)
5353

5454
prefix = "http://"
55-
get_grpc_channel(prefix + host_name, METADATA)
55+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
5656
mock_insecure_channel.assert_called_with(host_name)
5757

5858
prefix = "HTTP://"
59-
get_grpc_channel(prefix + host_name, METADATA)
59+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
6060
mock_insecure_channel.assert_called_with(host_name)
6161

6262
prefix = "GRPC://"
63-
get_grpc_channel(prefix + host_name, METADATA)
63+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
6464
mock_insecure_channel.assert_called_with(host_name)
6565

6666
prefix = ""
67-
get_grpc_channel(prefix + host_name, METADATA)
67+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
6868
mock_insecure_channel.assert_called_with(host_name)
6969

7070
prefix = "grpcs://"
71-
get_grpc_channel(prefix + host_name, METADATA)
71+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
7272
mock_secure_channel.assert_called_with(host_name, ANY)
7373

7474
prefix = "https://"
75-
get_grpc_channel(prefix + host_name, METADATA)
75+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
7676
mock_secure_channel.assert_called_with(host_name, ANY)
7777

7878
prefix = "HTTPS://"
79-
get_grpc_channel(prefix + host_name, METADATA)
79+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
8080
mock_secure_channel.assert_called_with(host_name, ANY)
8181

8282
prefix = "GRPCS://"
83-
get_grpc_channel(prefix + host_name, METADATA)
83+
get_grpc_channel(prefix + host_name, interceptors=INTERCEPTORS)
8484
mock_secure_channel.assert_called_with(host_name, ANY)
8585

8686
prefix = ""
87-
get_grpc_channel(prefix + host_name, METADATA, True)
87+
get_grpc_channel(prefix + host_name, True, interceptors=INTERCEPTORS)
8888
mock_secure_channel.assert_called_with(host_name, ANY)

0 commit comments

Comments
 (0)