@@ -46,39 +46,41 @@ class TestCreateStub(unittest2.TestCase):
4646 FAKE_SERVICE_PATH = 'service_path'
4747 FAKE_PORT = 10101
4848
49- @mock .patch ('grpc.beta.implementations. composite_channel_credentials' )
50- @mock .patch ('grpc.beta.implementations. ssl_channel_credentials' )
51- @mock .patch ('grpc.beta.implementations. secure_channel' )
49+ @mock .patch ('grpc.composite_channel_credentials' )
50+ @mock .patch ('grpc.ssl_channel_credentials' )
51+ @mock .patch ('grpc.secure_channel' )
5252 @mock .patch ('google.gax.auth.make_auth_func' )
5353 def test_creates_a_stub_ok_with_no_scopes (
5454 self , auth , chan , chan_creds , comp ):
5555 got_channel = grpc .create_stub (
5656 _fake_create_stub , self .FAKE_SERVICE_PATH , self .FAKE_PORT )
57- chan_creds .assert_called_once_with (None , None , None )
58- chan .assert_called_once_with (self .FAKE_SERVICE_PATH , self .FAKE_PORT ,
59- comp .return_value )
57+ chan_creds .assert_called_once_with ()
58+ chan .assert_called_once_with (
59+ '{}:{}' .format (self .FAKE_SERVICE_PATH , self .FAKE_PORT ),
60+ comp .return_value )
6061 auth .assert_called_once_with ([])
6162 self .assertEqual (got_channel , chan .return_value )
6263
63- @mock .patch ('grpc.beta.implementations. composite_channel_credentials' )
64- @mock .patch ('grpc.beta.implementations. ssl_channel_credentials' )
65- @mock .patch ('grpc.beta.implementations. secure_channel' )
64+ @mock .patch ('grpc.composite_channel_credentials' )
65+ @mock .patch ('grpc.ssl_channel_credentials' )
66+ @mock .patch ('grpc.secure_channel' )
6667 @mock .patch ('google.gax.auth.make_auth_func' )
6768 def test_creates_a_stub_ok_with_scopes (
6869 self , auth , chan , chan_creds , comp ):
6970 fake_scopes = ['dummy' , 'scopes' ]
7071 grpc .create_stub (
7172 _fake_create_stub , self .FAKE_SERVICE_PATH , self .FAKE_PORT ,
7273 scopes = fake_scopes )
73- chan_creds .assert_called_once_with (None , None , None )
74- chan .assert_called_once_with (self .FAKE_SERVICE_PATH , self .FAKE_PORT ,
75- comp .return_value )
74+ chan_creds .assert_called_once_with ()
75+ chan .assert_called_once_with (
76+ '{}:{}' .format (self .FAKE_SERVICE_PATH , self .FAKE_PORT ),
77+ comp .return_value )
7678 auth .assert_called_once_with (fake_scopes )
7779
78- @mock .patch ('grpc.beta.implementations. metadata_call_credentials' )
79- @mock .patch ('grpc.beta.implementations. composite_channel_credentials' )
80- @mock .patch ('grpc.beta.implementations. ssl_channel_credentials' )
81- @mock .patch ('grpc.beta.implementations. secure_channel' )
80+ @mock .patch ('grpc.metadata_call_credentials' )
81+ @mock .patch ('grpc.composite_channel_credentials' )
82+ @mock .patch ('grpc.ssl_channel_credentials' )
83+ @mock .patch ('grpc.secure_channel' )
8284 @mock .patch ('google.gax.auth.make_auth_func' )
8385 def test_creates_a_stub_with_given_channel (
8486 self , auth , chan , chan_creds , comp , md ):
@@ -93,29 +95,30 @@ def test_creates_a_stub_with_given_channel(
9395 self .assertFalse (comp .called )
9496 self .assertFalse (md .called )
9597
96- @mock .patch ('grpc.beta.implementations. metadata_call_credentials' )
97- @mock .patch ('grpc.beta.implementations. composite_channel_credentials' )
98- @mock .patch ('grpc.beta.implementations. ssl_channel_credentials' )
99- @mock .patch ('grpc.beta.implementations. secure_channel' )
98+ @mock .patch ('grpc.metadata_call_credentials' )
99+ @mock .patch ('grpc.composite_channel_credentials' )
100+ @mock .patch ('grpc.ssl_channel_credentials' )
101+ @mock .patch ('grpc.secure_channel' )
100102 @mock .patch ('google.gax.auth.make_auth_func' )
101103 def test_creates_a_stub_ok_with_given_creds (self , auth , chan , chan_creds ,
102104 comp , md ):
103105 fake_creds = object ()
104106 got_channel = grpc .create_stub (
105107 _fake_create_stub , self .FAKE_SERVICE_PATH , self .FAKE_PORT ,
106108 ssl_creds = fake_creds )
107- chan .assert_called_once_with (self .FAKE_SERVICE_PATH , self .FAKE_PORT ,
108- comp .return_value )
109+ chan .assert_called_once_with (
110+ '{}:{}' .format (self .FAKE_SERVICE_PATH , self .FAKE_PORT ),
111+ comp .return_value )
109112 auth .assert_called_once_with ([])
110113 self .assertTrue (chan .called )
111114 self .assertFalse (chan_creds .called )
112115 self .assertTrue (comp .called )
113116 self .assertTrue (md .called )
114117 self .assertEqual (got_channel , chan .return_value )
115118
116- @mock .patch ('grpc.beta.implementations. composite_channel_credentials' )
117- @mock .patch ('grpc.beta.implementations. ssl_channel_credentials' )
118- @mock .patch ('grpc.beta.implementations. secure_channel' )
119+ @mock .patch ('grpc.composite_channel_credentials' )
120+ @mock .patch ('grpc.ssl_channel_credentials' )
121+ @mock .patch ('grpc.secure_channel' )
119122 @mock .patch ('google.gax.auth.make_auth_func' )
120123 def test_creates_a_stub_ok_with_given_auth_func (self , auth , dummy_chan ,
121124 dummy_chan_creds , dummy_md ):
0 commit comments