@@ -97,10 +97,27 @@ def test_it(self):
9797 mock_result = object ()
9898 stub_inputs = []
9999
100- def mock_stub_factory (host , port , metadata_transformer = None ,
101- secure = None , root_certificates = None ):
102- stub_inputs .append ((host , port , metadata_transformer ,
103- secure , root_certificates ))
100+ CLIENT_CREDS = object ()
101+ CHANNEL = object ()
102+
103+ class _ImplementationsModule (object ):
104+
105+ def __init__ (self ):
106+ self .ssl_client_credentials_args = None
107+ self .secure_channel_args = None
108+
109+ def ssl_client_credentials (self , * args , ** kwargs ):
110+ self .ssl_client_credentials_args = (args , kwargs )
111+ return CLIENT_CREDS
112+
113+ def secure_channel (self , * args , ** kwargs ):
114+ self .secure_channel_args = (args , kwargs )
115+ return CHANNEL
116+
117+ implementations_mod = _ImplementationsModule ()
118+
119+ def mock_stub_factory (channel , metadata_transformer = None ):
120+ stub_inputs .append ((channel , metadata_transformer ))
104121 return mock_result
105122
106123 transformed = object ()
@@ -115,12 +132,18 @@ def mock_transformer(client):
115132 certs = 'FOOBAR'
116133 client = object ()
117134 with _Monkey (MUT , get_certs = lambda : certs ,
135+ implementations = implementations_mod ,
118136 MetadataTransformer = mock_transformer ):
119137 result = self ._callFUT (client , mock_stub_factory , host , port )
120138
121139 self .assertTrue (result is mock_result )
122- self .assertEqual (stub_inputs , [(host , port , transformed , True , certs )])
140+ self .assertEqual (stub_inputs , [(CHANNEL , transformed )])
123141 self .assertEqual (clients , [client ])
142+ ssl_cli_kwargs = {'private_key' : None , 'certificate_chain' : None }
143+ self .assertEqual (implementations_mod .ssl_client_credentials_args ,
144+ ((certs ,), ssl_cli_kwargs ))
145+ self .assertEqual (implementations_mod .secure_channel_args ,
146+ ((host , port , CLIENT_CREDS ), {}))
124147
125148
126149class _Credentials (object ):
0 commit comments