@@ -169,6 +169,7 @@ def test_get_connection_details_success_with_host(
169
169
mock_response = mock .MagicMock ()
170
170
mock_response .status_code = 200
171
171
mock_response .json .return_value = {
172
+ "name" : "test-connection" ,
172
173
"serviceDirectory" : "test_service" ,
173
174
"host" : "test.host" ,
174
175
"tlsServiceDirectory" : "tls_test_service" ,
@@ -180,6 +181,7 @@ def test_get_connection_details_success_with_host(
180
181
):
181
182
details = client .get_connection_details ()
182
183
assert details == {
184
+ "name" : "test-connection" ,
183
185
"serviceName" : "tls_test_service" ,
184
186
"host" : "test.host" ,
185
187
"authOverrideEnabled" : True ,
@@ -193,6 +195,7 @@ def test_get_connection_details_success_without_host(
193
195
mock_response = mock .MagicMock ()
194
196
mock_response .status_code = 200
195
197
mock_response .json .return_value = {
198
+ "name" : "test-connection" ,
196
199
"serviceDirectory" : "test_service" ,
197
200
"authOverrideEnabled" : False ,
198
201
}
@@ -202,11 +205,35 @@ def test_get_connection_details_success_without_host(
202
205
):
203
206
details = client .get_connection_details ()
204
207
assert details == {
208
+ "name" : "test-connection" ,
205
209
"serviceName" : "test_service" ,
206
210
"host" : "" ,
207
211
"authOverrideEnabled" : False ,
208
212
}
213
+
214
+ def test_get_connection_details_without_name (
215
+ self , project , location , connection_name , mock_credentials
216
+ ):
217
+ credentials = {
"email" :
"[email protected] " }
218
+ client = ConnectionsClient (project , location , connection_name , credentials )
219
+ mock_response = mock .MagicMock ()
220
+ mock_response .status_code = 200
221
+ mock_response .json .return_value = {
222
+ "serviceDirectory" : "test_service" ,
223
+ "authOverrideEnabled" : False ,
224
+ }
209
225
226
+ with mock .patch .object (
227
+ client , "_execute_api_call" , return_value = mock_response
228
+ ):
229
+ details = client .get_connection_details ()
230
+ assert details == {
231
+ "name" : "" ,
232
+ "serviceName" : "test_service" ,
233
+ "host" : "" ,
234
+ "authOverrideEnabled" : False ,
235
+ }
236
+
210
237
def test_get_connection_details_error (
211
238
self , project , location , connection_name
212
239
):
@@ -419,21 +446,21 @@ def test_get_operation_static(self):
419
446
def test_create_operation (self ):
420
447
operation = ConnectionsClient .create_operation ("Entity1" , "test_tool" )
421
448
assert "post" in operation
422
- assert operation ["post" ]["summary" ] == "Create Entity1"
449
+ assert operation ["post" ]["summary" ] == "Creates a new Entity1"
423
450
assert "operationId" in operation ["post" ]
424
451
assert operation ["post" ]["operationId" ] == "test_tool_create_Entity1"
425
452
426
453
def test_update_operation (self ):
427
454
operation = ConnectionsClient .update_operation ("Entity1" , "test_tool" )
428
455
assert "post" in operation
429
- assert operation ["post" ]["summary" ] == "Update Entity1"
456
+ assert operation ["post" ]["summary" ] == "Updates the Entity1"
430
457
assert "operationId" in operation ["post" ]
431
458
assert operation ["post" ]["operationId" ] == "test_tool_update_Entity1"
432
459
433
460
def test_delete_operation (self ):
434
461
operation = ConnectionsClient .delete_operation ("Entity1" , "test_tool" )
435
462
assert "post" in operation
436
- assert operation ["post" ]["summary" ] == "Delete Entity1"
463
+ assert operation ["post" ]["summary" ] == "Delete the Entity1"
437
464
assert operation ["post" ]["operationId" ] == "test_tool_delete_Entity1"
438
465
439
466
def test_create_operation_request (self ):
0 commit comments