Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit 100f72e

Browse filesBrowse files
fix(v1beta1): disable always_use_jwt_access (#52)
Committer: @busunkim96 PiperOrigin-RevId: 382142900 Source-Link: googleapis/googleapis@513440f Source-Link: https://github.com/googleapis/googleapis-gen/commit/7b1e2c31233f79a704ec21ca410bf661d6bc68d0
1 parent f11dcfd commit 100f72e
Copy full SHA for 100f72e

File tree

Expand file treeCollapse file tree

3 files changed

+27
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+27
-3
lines changed
Open diff view settings
Collapse file

‎google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc.py‎

Copy file name to clipboardExpand all lines: google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(
6161
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
6262
quota_project_id: Optional[str] = None,
6363
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
64+
always_use_jwt_access: Optional[bool] = False,
6465
) -> None:
6566
"""Instantiate the transport.
6667
@@ -101,6 +102,8 @@ def __init__(
101102
API requests. If ``None``, then default info will be used.
102103
Generally, you only need to set this if you're developing
103104
your own client library.
105+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
106+
be used for service account credentials.
104107
105108
Raises:
106109
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
@@ -154,7 +157,7 @@ def __init__(
154157
scopes=scopes,
155158
quota_project_id=quota_project_id,
156159
client_info=client_info,
157-
always_use_jwt_access=True,
160+
always_use_jwt_access=always_use_jwt_access,
158161
)
159162

160163
if not self._grpc_channel:
Collapse file

‎google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc_asyncio.py‎

Copy file name to clipboardExpand all lines: google/cloud/gkehub_v1beta1/services/gke_hub_membership_service/transports/grpc_asyncio.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def __init__(
107107
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
108108
quota_project_id=None,
109109
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
110+
always_use_jwt_access: Optional[bool] = False,
110111
) -> None:
111112
"""Instantiate the transport.
112113
@@ -148,6 +149,8 @@ def __init__(
148149
API requests. If ``None``, then default info will be used.
149150
Generally, you only need to set this if you're developing
150151
your own client library.
152+
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
153+
be used for service account credentials.
151154
152155
Raises:
153156
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
@@ -200,7 +203,7 @@ def __init__(
200203
scopes=scopes,
201204
quota_project_id=quota_project_id,
202205
client_info=client_info,
203-
always_use_jwt_access=True,
206+
always_use_jwt_access=always_use_jwt_access,
204207
)
205208

206209
if not self._grpc_channel:
Collapse file

‎tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py‎

Copy file name to clipboardExpand all lines: tests/unit/gapic/gkehub_v1beta1/test_gke_hub_membership_service.py
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,25 @@ def test_gke_hub_membership_service_client_service_account_always_use_jwt(client
139139
) as use_jwt:
140140
creds = service_account.Credentials(None, None, None)
141141
client = client_class(credentials=creds)
142-
use_jwt.assert_called_with(True)
142+
use_jwt.assert_not_called()
143+
144+
145+
@pytest.mark.parametrize(
146+
"transport_class,transport_name",
147+
[
148+
(transports.GkeHubMembershipServiceGrpcTransport, "grpc"),
149+
(transports.GkeHubMembershipServiceGrpcAsyncIOTransport, "grpc_asyncio"),
150+
],
151+
)
152+
def test_gke_hub_membership_service_client_service_account_always_use_jwt_true(
153+
transport_class, transport_name
154+
):
155+
with mock.patch.object(
156+
service_account.Credentials, "with_always_use_jwt_access", create=True
157+
) as use_jwt:
158+
creds = service_account.Credentials(None, None, None)
159+
transport = transport_class(credentials=creds, always_use_jwt_access=True)
160+
use_jwt.assert_called_once_with(True)
143161

144162

145163
@pytest.mark.parametrize(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.