@@ -523,21 +523,28 @@ def test_error_group_service_client_client_options_scopes(
523
523
524
524
525
525
@pytest .mark .parametrize (
526
- "client_class,transport_class,transport_name" ,
526
+ "client_class,transport_class,transport_name,grpc_helpers " ,
527
527
[
528
- (ErrorGroupServiceClient , transports .ErrorGroupServiceGrpcTransport , "grpc" ),
528
+ (
529
+ ErrorGroupServiceClient ,
530
+ transports .ErrorGroupServiceGrpcTransport ,
531
+ "grpc" ,
532
+ grpc_helpers ,
533
+ ),
529
534
(
530
535
ErrorGroupServiceAsyncClient ,
531
536
transports .ErrorGroupServiceGrpcAsyncIOTransport ,
532
537
"grpc_asyncio" ,
538
+ grpc_helpers_async ,
533
539
),
534
540
],
535
541
)
536
542
def test_error_group_service_client_client_options_credentials_file (
537
- client_class , transport_class , transport_name
543
+ client_class , transport_class , transport_name , grpc_helpers
538
544
):
539
545
# Check the case credentials file is provided.
540
546
options = client_options .ClientOptions (credentials_file = "credentials.json" )
547
+
541
548
with mock .patch .object (transport_class , "__init__" ) as patched :
542
549
patched .return_value = None
543
550
client = client_class (client_options = options , transport = transport_name )
@@ -573,6 +580,72 @@ def test_error_group_service_client_client_options_from_dict():
573
580
)
574
581
575
582
583
+ @pytest .mark .parametrize (
584
+ "client_class,transport_class,transport_name,grpc_helpers" ,
585
+ [
586
+ (
587
+ ErrorGroupServiceClient ,
588
+ transports .ErrorGroupServiceGrpcTransport ,
589
+ "grpc" ,
590
+ grpc_helpers ,
591
+ ),
592
+ (
593
+ ErrorGroupServiceAsyncClient ,
594
+ transports .ErrorGroupServiceGrpcAsyncIOTransport ,
595
+ "grpc_asyncio" ,
596
+ grpc_helpers_async ,
597
+ ),
598
+ ],
599
+ )
600
+ def test_error_group_service_client_create_channel_credentials_file (
601
+ client_class , transport_class , transport_name , grpc_helpers
602
+ ):
603
+ # Check the case credentials file is provided.
604
+ options = client_options .ClientOptions (credentials_file = "credentials.json" )
605
+
606
+ with mock .patch .object (transport_class , "__init__" ) as patched :
607
+ patched .return_value = None
608
+ client = client_class (client_options = options , transport = transport_name )
609
+ patched .assert_called_once_with (
610
+ credentials = None ,
611
+ credentials_file = "credentials.json" ,
612
+ host = client .DEFAULT_ENDPOINT ,
613
+ scopes = None ,
614
+ client_cert_source_for_mtls = None ,
615
+ quota_project_id = None ,
616
+ client_info = transports .base .DEFAULT_CLIENT_INFO ,
617
+ always_use_jwt_access = True ,
618
+ )
619
+
620
+ # test that the credentials from file are saved and used as the credentials.
621
+ with mock .patch .object (
622
+ google .auth , "load_credentials_from_file" , autospec = True
623
+ ) as load_creds , mock .patch .object (
624
+ google .auth , "default" , autospec = True
625
+ ) as adc , mock .patch .object (
626
+ grpc_helpers , "create_channel"
627
+ ) as create_channel :
628
+ creds = ga_credentials .AnonymousCredentials ()
629
+ file_creds = ga_credentials .AnonymousCredentials ()
630
+ load_creds .return_value = (file_creds , None )
631
+ adc .return_value = (creds , None )
632
+ client = client_class (client_options = options , transport = transport_name )
633
+ create_channel .assert_called_with (
634
+ "clouderrorreporting.googleapis.com:443" ,
635
+ credentials = file_creds ,
636
+ credentials_file = None ,
637
+ quota_project_id = None ,
638
+ default_scopes = ("https://www.googleapis.com/auth/cloud-platform" ,),
639
+ scopes = None ,
640
+ default_host = "clouderrorreporting.googleapis.com" ,
641
+ ssl_credentials = None ,
642
+ options = [
643
+ ("grpc.max_send_message_length" , - 1 ),
644
+ ("grpc.max_receive_message_length" , - 1 ),
645
+ ],
646
+ )
647
+
648
+
576
649
@pytest .mark .parametrize ("request_type" , [error_group_service .GetGroupRequest , dict ,])
577
650
def test_get_group (request_type , transport : str = "grpc" ):
578
651
client = ErrorGroupServiceClient (
0 commit comments