Skip to content

Commit 77a9213

Browse files
chore: use gapic-generator-python 0.62.1 (#187)
- [ ] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: googleapis/googleapis@84b1a5a Source-Link: googleapis/googleapis-gen@4fb761b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9
1 parent 6b262ca commit 77a9213

File tree

7 files changed

+230
-150
lines changed

7 files changed

+230
-150
lines changed

packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py

Lines changed: 71 additions & 71 deletions
Large diffs are not rendered by default.

packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py

Lines changed: 71 additions & 71 deletions
Large diffs are not rendered by default.

packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ def __init__(
160160
if not self._grpc_channel:
161161
self._grpc_channel = type(self).create_channel(
162162
self._host,
163+
# use the credentials which are saved
163164
credentials=self._credentials,
164-
credentials_file=credentials_file,
165+
# Set ``credentials_file`` to ``None`` here as
166+
# the credentials that we saved earlier should be used.
167+
credentials_file=None,
165168
scopes=self._scopes,
166169
ssl_credentials=self._ssl_channel_credentials,
167170
quota_project_id=quota_project_id,

packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,11 @@ def __init__(
205205
if not self._grpc_channel:
206206
self._grpc_channel = type(self).create_channel(
207207
self._host,
208+
# use the credentials which are saved
208209
credentials=self._credentials,
209-
credentials_file=credentials_file,
210+
# Set ``credentials_file`` to ``None`` here as
211+
# the credentials that we saved earlier should be used.
212+
credentials_file=None,
210213
scopes=self._scopes,
211214
ssl_credentials=self._ssl_channel_credentials,
212215
quota_project_id=quota_project_id,

packages/google-analytics-admin/google/analytics/admin_v1alpha/types/analytics_admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ class DeleteAccountRequest(proto.Message):
202202
203203
Attributes:
204204
name (str):
205-
Required. The name of the Account to soft-
206-
elete. Format: accounts/{account}
205+
Required. The name of the Account to
206+
soft-delete. Format: accounts/{account}
207207
Example: "accounts/100".
208208
"""
209209

packages/google-analytics-admin/google/analytics/admin_v1alpha/types/resources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,8 @@ class CustomDimension(proto.Message):
12211221
Required. Immutable. Tagging parameter name
12221222
for this custom dimension.
12231223
If this is a user-scoped dimension, then this is
1224-
the user property name. If this is an event-
1225-
scoped dimension, then this is the event
1224+
the user property name. If this is an
1225+
event-scoped dimension, then this is the event
12261226
parameter name.
12271227
12281228
May only contain alphanumeric and underscore

packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,25 +535,28 @@ def test_analytics_admin_service_client_client_options_scopes(
535535

536536

537537
@pytest.mark.parametrize(
538-
"client_class,transport_class,transport_name",
538+
"client_class,transport_class,transport_name,grpc_helpers",
539539
[
540540
(
541541
AnalyticsAdminServiceClient,
542542
transports.AnalyticsAdminServiceGrpcTransport,
543543
"grpc",
544+
grpc_helpers,
544545
),
545546
(
546547
AnalyticsAdminServiceAsyncClient,
547548
transports.AnalyticsAdminServiceGrpcAsyncIOTransport,
548549
"grpc_asyncio",
550+
grpc_helpers_async,
549551
),
550552
],
551553
)
552554
def test_analytics_admin_service_client_client_options_credentials_file(
553-
client_class, transport_class, transport_name
555+
client_class, transport_class, transport_name, grpc_helpers
554556
):
555557
# Check the case credentials file is provided.
556558
options = client_options.ClientOptions(credentials_file="credentials.json")
559+
557560
with mock.patch.object(transport_class, "__init__") as patched:
558561
patched.return_value = None
559562
client = client_class(client_options=options, transport=transport_name)
@@ -589,6 +592,77 @@ def test_analytics_admin_service_client_client_options_from_dict():
589592
)
590593

591594

595+
@pytest.mark.parametrize(
596+
"client_class,transport_class,transport_name,grpc_helpers",
597+
[
598+
(
599+
AnalyticsAdminServiceClient,
600+
transports.AnalyticsAdminServiceGrpcTransport,
601+
"grpc",
602+
grpc_helpers,
603+
),
604+
(
605+
AnalyticsAdminServiceAsyncClient,
606+
transports.AnalyticsAdminServiceGrpcAsyncIOTransport,
607+
"grpc_asyncio",
608+
grpc_helpers_async,
609+
),
610+
],
611+
)
612+
def test_analytics_admin_service_client_create_channel_credentials_file(
613+
client_class, transport_class, transport_name, grpc_helpers
614+
):
615+
# Check the case credentials file is provided.
616+
options = client_options.ClientOptions(credentials_file="credentials.json")
617+
618+
with mock.patch.object(transport_class, "__init__") as patched:
619+
patched.return_value = None
620+
client = client_class(client_options=options, transport=transport_name)
621+
patched.assert_called_once_with(
622+
credentials=None,
623+
credentials_file="credentials.json",
624+
host=client.DEFAULT_ENDPOINT,
625+
scopes=None,
626+
client_cert_source_for_mtls=None,
627+
quota_project_id=None,
628+
client_info=transports.base.DEFAULT_CLIENT_INFO,
629+
always_use_jwt_access=True,
630+
)
631+
632+
# test that the credentials from file are saved and used as the credentials.
633+
with mock.patch.object(
634+
google.auth, "load_credentials_from_file", autospec=True
635+
) as load_creds, mock.patch.object(
636+
google.auth, "default", autospec=True
637+
) as adc, mock.patch.object(
638+
grpc_helpers, "create_channel"
639+
) as create_channel:
640+
creds = ga_credentials.AnonymousCredentials()
641+
file_creds = ga_credentials.AnonymousCredentials()
642+
load_creds.return_value = (file_creds, None)
643+
adc.return_value = (creds, None)
644+
client = client_class(client_options=options, transport=transport_name)
645+
create_channel.assert_called_with(
646+
"analyticsadmin.googleapis.com:443",
647+
credentials=file_creds,
648+
credentials_file=None,
649+
quota_project_id=None,
650+
default_scopes=(
651+
"https://www.googleapis.com/auth/analytics.edit",
652+
"https://www.googleapis.com/auth/analytics.manage.users",
653+
"https://www.googleapis.com/auth/analytics.manage.users.readonly",
654+
"https://www.googleapis.com/auth/analytics.readonly",
655+
),
656+
scopes=None,
657+
default_host="analyticsadmin.googleapis.com",
658+
ssl_credentials=None,
659+
options=[
660+
("grpc.max_send_message_length", -1),
661+
("grpc.max_receive_message_length", -1),
662+
],
663+
)
664+
665+
592666
@pytest.mark.parametrize("request_type", [analytics_admin.GetAccountRequest, dict,])
593667
def test_get_account(request_type, transport: str = "grpc"):
594668
client = AnalyticsAdminServiceClient(

0 commit comments

Comments
 (0)