From c1c960894dc401b0a125801b08ef1a4fee659abe Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 30 Jun 2021 16:57:15 -0700 Subject: [PATCH] fix: disable always_use_jwt_access (#123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.50.3 fix: disable always_use_jwt_access Committer: @busunkim96 PiperOrigin-RevId: 382142900 Source-Link: https://github.com/googleapis/googleapis/commit/513440fda515f3c799c22a30e3906dcda325004e Source-Link: https://github.com/googleapis/googleapis-gen/commit/7b1e2c31233f79a704ec21ca410bf661d6bc68d0 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Dina Graves Portman --- google/cloud/devtools/cloudbuild/__init__.py | 2 + .../cloud/devtools/cloudbuild_v1/__init__.py | 2 + .../services/cloud_build/transports/base.py | 2 +- .../services/cloud_build/transports/grpc.py | 5 +- .../cloud_build/transports/grpc_asyncio.py | 5 +- .../devtools/cloudbuild_v1/types/__init__.py | 2 + .../cloudbuild_v1/types/cloudbuild.py | 122 ++++++++++++++++-- scripts/fixup_cloudbuild_v1_keywords.py | 12 +- .../gapic/cloudbuild_v1/test_cloud_build.py | 76 ++++++++--- 9 files changed, 189 insertions(+), 39 deletions(-) diff --git a/google/cloud/devtools/cloudbuild/__init__.py b/google/cloud/devtools/cloudbuild/__init__.py index 1096a76f..261dafed 100644 --- a/google/cloud/devtools/cloudbuild/__init__.py +++ b/google/cloud/devtools/cloudbuild/__init__.py @@ -83,6 +83,7 @@ ) from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import UpdateWorkerPoolRequest from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Volume +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import WebhookConfig from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import WorkerConfig from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import WorkerPool @@ -137,6 +138,7 @@ "UpdateBuildTriggerRequest", "UpdateWorkerPoolRequest", "Volume", + "WebhookConfig", "WorkerConfig", "WorkerPool", ) diff --git a/google/cloud/devtools/cloudbuild_v1/__init__.py b/google/cloud/devtools/cloudbuild_v1/__init__.py index 4e05790c..15505413 100644 --- a/google/cloud/devtools/cloudbuild_v1/__init__.py +++ b/google/cloud/devtools/cloudbuild_v1/__init__.py @@ -65,6 +65,7 @@ from .types.cloudbuild import UpdateBuildTriggerRequest from .types.cloudbuild import UpdateWorkerPoolRequest from .types.cloudbuild import Volume +from .types.cloudbuild import WebhookConfig from .types.cloudbuild import WorkerConfig from .types.cloudbuild import WorkerPool @@ -119,6 +120,7 @@ "UpdateBuildTriggerRequest", "UpdateWorkerPoolRequest", "Volume", + "WebhookConfig", "WorkerConfig", "WorkerPool", ) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py index 0e1ac732..4fe2d519 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py @@ -101,7 +101,7 @@ def __init__( scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) # Save the scopes. - self._scopes = scopes or self.AUTH_SCOPES + self._scopes = scopes # If no credentials are provided, then determine the appropriate # defaults. diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py index e00d7c4c..ed0fbf11 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py @@ -67,6 +67,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -107,6 +108,8 @@ def __init__( API requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. Raises: google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport @@ -160,7 +163,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py index 74ad1988..db2426be 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py @@ -113,6 +113,7 @@ def __init__( client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, ) -> None: """Instantiate the transport. @@ -154,6 +155,8 @@ def __init__( API requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport @@ -206,7 +209,7 @@ def __init__( scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, - always_use_jwt_access=True, + always_use_jwt_access=always_use_jwt_access, ) if not self._grpc_channel: diff --git a/google/cloud/devtools/cloudbuild_v1/types/__init__.py b/google/cloud/devtools/cloudbuild_v1/types/__init__.py index be5de0af..42004be6 100644 --- a/google/cloud/devtools/cloudbuild_v1/types/__init__.py +++ b/google/cloud/devtools/cloudbuild_v1/types/__init__.py @@ -62,6 +62,7 @@ UpdateBuildTriggerRequest, UpdateWorkerPoolRequest, Volume, + WebhookConfig, WorkerConfig, WorkerPool, ) @@ -115,6 +116,7 @@ "UpdateBuildTriggerRequest", "UpdateWorkerPoolRequest", "Volume", + "WebhookConfig", "WorkerConfig", "WorkerPool", ) diff --git a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py index 99a51ddc..f4013600 100644 --- a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py +++ b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py @@ -53,6 +53,7 @@ "BuildTrigger", "GitHubEventsConfig", "PubsubConfig", + "WebhookConfig", "PullRequestFilter", "PushFilter", "CreateBuildTriggerRequest", @@ -99,6 +100,9 @@ class RunBuildTriggerRequest(proto.Message): r"""Specifies a build trigger to run and the source to use. Attributes: + name (str): + The name of the ``Trigger`` to run. Format: + ``projects/{project}/locations/{location}/triggers/{trigger}`` project_id (str): Required. ID of the project. trigger_id (str): @@ -107,6 +111,7 @@ class RunBuildTriggerRequest(proto.Message): Source to build against this trigger. """ + name = proto.Field(proto.STRING, number=4,) project_id = proto.Field(proto.STRING, number=1,) trigger_id = proto.Field(proto.STRING, number=2,) source = proto.Field(proto.MESSAGE, number=3, message="RepoSource",) @@ -185,8 +190,9 @@ class RepoSource(proto.Message): class StorageSourceManifest(proto.Message): - r"""Location of the source manifest in Google Cloud Storage. - This feature is in Preview. + r"""Location of the source manifest in Google Cloud Storage. This + feature is in Preview; see description + `here `__. Attributes: bucket (str): @@ -219,9 +225,9 @@ class Source(proto.Message): If provided, get the source from this location in a Cloud Source Repository. storage_source_manifest (google.cloud.devtools.cloudbuild_v1.types.StorageSourceManifest): - If provided, get the source from this - manifest in Google Cloud Storage. This feature - is in Preview. + If provided, get the source from this manifest in Google + Cloud Storage. This feature is in Preview; see description + `here `__. """ storage_source = proto.Field( @@ -571,10 +577,11 @@ class Build(proto.Message): runtime. Must be of the format ``projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}``. ACCOUNT can be email address or uniqueId of the service account. - - This field is in beta. available_secrets (google.cloud.devtools.cloudbuild_v1.types.Secrets): Secrets and secret environment variables. + warnings (Sequence[google.cloud.devtools.cloudbuild_v1.types.Build.Warning]): + Output only. Non-fatal problems encountered + during the execution of the build. """ class Status(proto.Enum): @@ -589,6 +596,27 @@ class Status(proto.Enum): CANCELLED = 7 EXPIRED = 9 + class Warning(proto.Message): + r"""A non-fatal problem encountered during the execution of the + build. + + Attributes: + text (str): + Explanation of the warning generated. + priority (google.cloud.devtools.cloudbuild_v1.types.Build.Warning.Priority): + The priority for this warning. + """ + + class Priority(proto.Enum): + r"""The relative importance of this warning.""" + PRIORITY_UNSPECIFIED = 0 + INFO = 1 + WARNING = 2 + ALERT = 3 + + text = proto.Field(proto.STRING, number=1,) + priority = proto.Field(proto.ENUM, number=2, enum="Build.Warning.Priority",) + name = proto.Field(proto.STRING, number=45,) id = proto.Field(proto.STRING, number=1,) project_id = proto.Field(proto.STRING, number=16,) @@ -617,6 +645,7 @@ class Status(proto.Enum): timing = proto.MapField(proto.STRING, proto.MESSAGE, number=33, message="TimeSpan",) service_account = proto.Field(proto.STRING, number=42,) available_secrets = proto.Field(proto.MESSAGE, number=47, message="Secrets",) + warnings = proto.RepeatedField(proto.MESSAGE, number=49, message=Warning,) class Artifacts(proto.Message): @@ -978,6 +1007,11 @@ class BuildTrigger(proto.Message): repository changes. Attributes: + resource_name (str): + The ``Trigger`` name with format: + ``projects/{project}/locations/{location}/triggers/{trigger}``, + where {trigger} is a unique identifier generated by the + service. id (str): Output only. Unique identifier of the trigger. @@ -1008,9 +1042,23 @@ class BuildTrigger(proto.Message): Mutually exclusive with ``trigger_template``. pubsub_config (google.cloud.devtools.cloudbuild_v1.types.PubsubConfig): - Optional. PubsubConfig describes the - configuration of a trigger that creates a build - whenever a Pub/Sub message is published. + PubsubConfig describes the configuration of a + trigger that creates a build whenever a Pub/Sub + message is published. + webhook_config (google.cloud.devtools.cloudbuild_v1.types.WebhookConfig): + WebhookConfig describes the configuration of + a trigger that creates a build whenever a + webhook is sent to a trigger's webhook URL. + autodetect (bool): + Autodetect build configuration. The + following precedence is used (case insensitive): + 1. cloudbuild.yaml + 2. cloudbuild.yml + 3. cloudbuild.json + 4. Dockerfile + + Currently only available for GitHub App + Triggers. build (google.cloud.devtools.cloudbuild_v1.types.Build): Contents of the build template. filename (str): @@ -1052,6 +1100,7 @@ class BuildTrigger(proto.Message): string. """ + resource_name = proto.Field(proto.STRING, number=34,) id = proto.Field(proto.STRING, number=1,) description = proto.Field(proto.STRING, number=10,) name = proto.Field(proto.STRING, number=21,) @@ -1059,6 +1108,8 @@ class BuildTrigger(proto.Message): trigger_template = proto.Field(proto.MESSAGE, number=7, message="RepoSource",) github = proto.Field(proto.MESSAGE, number=13, message="GitHubEventsConfig",) pubsub_config = proto.Field(proto.MESSAGE, number=29, message="PubsubConfig",) + webhook_config = proto.Field(proto.MESSAGE, number=31, message="WebhookConfig",) + autodetect = proto.Field(proto.BOOL, number=18, oneof="build_template",) build = proto.Field( proto.MESSAGE, number=4, oneof="build_template", message="Build", ) @@ -1143,6 +1194,33 @@ class State(proto.Enum): state = proto.Field(proto.ENUM, number=4, enum=State,) +class WebhookConfig(proto.Message): + r"""WebhookConfig describes the configuration of a trigger that + creates a build whenever a webhook is sent to a trigger's + webhook URL. + + Attributes: + secret (str): + Required. Resource name for the secret + required as a URL parameter. + state (google.cloud.devtools.cloudbuild_v1.types.WebhookConfig.State): + Potential issues with the underlying Pub/Sub + subscription configuration. Only populated on + get requests. + """ + + class State(proto.Enum): + r"""Enumerates potential issues with the Secret Manager secret + provided by the user. + """ + STATE_UNSPECIFIED = 0 + OK = 1 + SECRET_DELETED = 2 + + secret = proto.Field(proto.STRING, number=3, oneof="auth_method",) + state = proto.Field(proto.ENUM, number=4, enum=State,) + + class PullRequestFilter(proto.Message): r"""PullRequestFilter contains filter properties for matching GitHub Pull Requests. @@ -1201,6 +1279,9 @@ class CreateBuildTriggerRequest(proto.Message): r"""Request to create a new ``BuildTrigger``. Attributes: + parent (str): + The parent resource where this trigger will be created. + Format: ``projects/{project}/locations/{location}`` project_id (str): Required. ID of the project for which to configure automatic builds. @@ -1208,6 +1289,7 @@ class CreateBuildTriggerRequest(proto.Message): Required. ``BuildTrigger`` to create. """ + parent = proto.Field(proto.STRING, number=3,) project_id = proto.Field(proto.STRING, number=1,) trigger = proto.Field(proto.MESSAGE, number=2, message="BuildTrigger",) @@ -1216,6 +1298,9 @@ class GetBuildTriggerRequest(proto.Message): r"""Returns the ``BuildTrigger`` with the specified ID. Attributes: + name (str): + The name of the ``Trigger`` to retrieve. Format: + ``projects/{project}/locations/{location}/triggers/{trigger}`` project_id (str): Required. ID of the project that owns the trigger. @@ -1224,6 +1309,7 @@ class GetBuildTriggerRequest(proto.Message): ``BuildTrigger`` to get. """ + name = proto.Field(proto.STRING, number=3,) project_id = proto.Field(proto.STRING, number=1,) trigger_id = proto.Field(proto.STRING, number=2,) @@ -1232,6 +1318,9 @@ class ListBuildTriggersRequest(proto.Message): r"""Request to list existing ``BuildTriggers``. Attributes: + parent (str): + The parent of the collection of ``Triggers``. Format: + ``projects/{project}/locations/{location}`` project_id (str): Required. ID of the project for which to list BuildTriggers. @@ -1242,6 +1331,7 @@ class ListBuildTriggersRequest(proto.Message): in the list. """ + parent = proto.Field(proto.STRING, number=4,) project_id = proto.Field(proto.STRING, number=1,) page_size = proto.Field(proto.INT32, number=2,) page_token = proto.Field(proto.STRING, number=3,) @@ -1270,6 +1360,9 @@ class DeleteBuildTriggerRequest(proto.Message): r"""Request to delete a ``BuildTrigger``. Attributes: + name (str): + The name of the ``Trigger`` to delete. Format: + ``projects/{project}/locations/{location}/triggers/{trigger}`` project_id (str): Required. ID of the project that owns the trigger. @@ -1277,6 +1370,7 @@ class DeleteBuildTriggerRequest(proto.Message): Required. ID of the ``BuildTrigger`` to delete. """ + name = proto.Field(proto.STRING, number=3,) project_id = proto.Field(proto.STRING, number=1,) trigger_id = proto.Field(proto.STRING, number=2,) @@ -1339,7 +1433,8 @@ class BuildOptions(proto.Message): Option to specify a ``WorkerPool`` for the build. Format: projects/{project}/locations/{location}/workerPools/{workerPool} - This field is experimental. + This field is in beta and is available only to restricted + users. logging (google.cloud.devtools.cloudbuild_v1.types.BuildOptions.LoggingMode): Option to specify the logging mode, which determines if and where build logs are stored. @@ -1435,6 +1530,10 @@ class ReceiveTriggerWebhookRequest(proto.Message): accepted by the ReceiveTriggerWebhook method. Attributes: + name (str): + The name of the ``ReceiveTriggerWebhook`` to retrieve. + Format: + ``projects/{project}/locations/{location}/triggers/{trigger}`` body (google.api.httpbody_pb2.HttpBody): HTTP request body. project_id (str): @@ -1447,6 +1546,7 @@ class ReceiveTriggerWebhookRequest(proto.Message): OAuth token isn't provided. """ + name = proto.Field(proto.STRING, number=5,) body = proto.Field(proto.MESSAGE, number=1, message=httpbody_pb2.HttpBody,) project_id = proto.Field(proto.STRING, number=2,) trigger = proto.Field(proto.STRING, number=3,) diff --git a/scripts/fixup_cloudbuild_v1_keywords.py b/scripts/fixup_cloudbuild_v1_keywords.py index 97755811..32908765 100644 --- a/scripts/fixup_cloudbuild_v1_keywords.py +++ b/scripts/fixup_cloudbuild_v1_keywords.py @@ -41,19 +41,19 @@ class cloudbuildCallTransformer(cst.CSTTransformer): METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'cancel_build': ('project_id', 'id', 'name', ), 'create_build': ('project_id', 'build', 'parent', ), - 'create_build_trigger': ('project_id', 'trigger', ), + 'create_build_trigger': ('project_id', 'trigger', 'parent', ), 'create_worker_pool': ('parent', 'worker_pool', ), - 'delete_build_trigger': ('project_id', 'trigger_id', ), + 'delete_build_trigger': ('project_id', 'trigger_id', 'name', ), 'delete_worker_pool': ('name', ), 'get_build': ('project_id', 'id', 'name', ), - 'get_build_trigger': ('project_id', 'trigger_id', ), + 'get_build_trigger': ('project_id', 'trigger_id', 'name', ), 'get_worker_pool': ('name', ), 'list_builds': ('project_id', 'parent', 'page_size', 'page_token', 'filter', ), - 'list_build_triggers': ('project_id', 'page_size', 'page_token', ), + 'list_build_triggers': ('project_id', 'parent', 'page_size', 'page_token', ), 'list_worker_pools': ('parent', ), - 'receive_trigger_webhook': ('body', 'project_id', 'trigger', 'secret', ), + 'receive_trigger_webhook': ('name', 'body', 'project_id', 'trigger', 'secret', ), 'retry_build': ('project_id', 'id', 'name', ), - 'run_build_trigger': ('project_id', 'trigger_id', 'source', ), + 'run_build_trigger': ('project_id', 'trigger_id', 'name', 'source', ), 'update_build_trigger': ('project_id', 'trigger_id', 'trigger', ), 'update_worker_pool': ('name', 'worker_pool', ), } diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index 09175cc6..8dcaaee8 100644 --- a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -130,7 +130,25 @@ def test_cloud_build_client_service_account_always_use_jwt(client_class): ) as use_jwt: creds = service_account.Credentials(None, None, None) client = client_class(credentials=creds) - use_jwt.assert_called_with(True) + use_jwt.assert_not_called() + + +@pytest.mark.parametrize( + "transport_class,transport_name", + [ + (transports.CloudBuildGrpcTransport, "grpc"), + (transports.CloudBuildGrpcAsyncIOTransport, "grpc_asyncio"), + ], +) +def test_cloud_build_client_service_account_always_use_jwt_true( + transport_class, transport_name +): + with mock.patch.object( + service_account.Credentials, "with_always_use_jwt_access", create=True + ) as use_jwt: + creds = service_account.Credentials(None, None, None) + transport = transport_class(credentials=creds, always_use_jwt_access=True) + use_jwt.assert_called_once_with(True) @pytest.mark.parametrize("client_class", [CloudBuildClient, CloudBuildAsyncClient,]) @@ -1451,6 +1469,7 @@ def test_create_build_trigger( ) as call: # Designate an appropriate return value for the call. call.return_value = cloudbuild.BuildTrigger( + resource_name="resource_name_value", id="id_value", description="description_value", name="name_value", @@ -1459,7 +1478,7 @@ def test_create_build_trigger( ignored_files=["ignored_files_value"], included_files=["included_files_value"], filter="filter_value", - build=cloudbuild.Build(name="name_value"), + autodetect=True, ) response = client.create_build_trigger(request) @@ -1470,6 +1489,7 @@ def test_create_build_trigger( # Establish that the response is the type that we expect. assert isinstance(response, cloudbuild.BuildTrigger) + assert response.resource_name == "resource_name_value" assert response.id == "id_value" assert response.description == "description_value" assert response.name == "name_value" @@ -1520,6 +1540,7 @@ async def test_create_build_trigger_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cloudbuild.BuildTrigger( + resource_name="resource_name_value", id="id_value", description="description_value", name="name_value", @@ -1539,6 +1560,7 @@ async def test_create_build_trigger_async( # Establish that the response is the type that we expect. assert isinstance(response, cloudbuild.BuildTrigger) + assert response.resource_name == "resource_name_value" assert response.id == "id_value" assert response.description == "description_value" assert response.name == "name_value" @@ -1567,7 +1589,7 @@ def test_create_build_trigger_flattened(): # using the keyword arguments to the method. client.create_build_trigger( project_id="project_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) # Establish that the underlying call was made with the expected @@ -1575,7 +1597,9 @@ def test_create_build_trigger_flattened(): assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] assert args[0].project_id == "project_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + assert args[0].trigger == cloudbuild.BuildTrigger( + resource_name="resource_name_value" + ) def test_create_build_trigger_flattened_error(): @@ -1587,7 +1611,7 @@ def test_create_build_trigger_flattened_error(): client.create_build_trigger( cloudbuild.CreateBuildTriggerRequest(), project_id="project_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) @@ -1609,7 +1633,7 @@ async def test_create_build_trigger_flattened_async(): # using the keyword arguments to the method. response = await client.create_build_trigger( project_id="project_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) # Establish that the underlying call was made with the expected @@ -1617,7 +1641,9 @@ async def test_create_build_trigger_flattened_async(): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] assert args[0].project_id == "project_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + assert args[0].trigger == cloudbuild.BuildTrigger( + resource_name="resource_name_value" + ) @pytest.mark.asyncio @@ -1630,7 +1656,7 @@ async def test_create_build_trigger_flattened_error_async(): await client.create_build_trigger( cloudbuild.CreateBuildTriggerRequest(), project_id="project_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) @@ -1651,6 +1677,7 @@ def test_get_build_trigger( ) as call: # Designate an appropriate return value for the call. call.return_value = cloudbuild.BuildTrigger( + resource_name="resource_name_value", id="id_value", description="description_value", name="name_value", @@ -1659,7 +1686,7 @@ def test_get_build_trigger( ignored_files=["ignored_files_value"], included_files=["included_files_value"], filter="filter_value", - build=cloudbuild.Build(name="name_value"), + autodetect=True, ) response = client.get_build_trigger(request) @@ -1670,6 +1697,7 @@ def test_get_build_trigger( # Establish that the response is the type that we expect. assert isinstance(response, cloudbuild.BuildTrigger) + assert response.resource_name == "resource_name_value" assert response.id == "id_value" assert response.description == "description_value" assert response.name == "name_value" @@ -1720,6 +1748,7 @@ async def test_get_build_trigger_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cloudbuild.BuildTrigger( + resource_name="resource_name_value", id="id_value", description="description_value", name="name_value", @@ -1739,6 +1768,7 @@ async def test_get_build_trigger_async( # Establish that the response is the type that we expect. assert isinstance(response, cloudbuild.BuildTrigger) + assert response.resource_name == "resource_name_value" assert response.id == "id_value" assert response.description == "description_value" assert response.name == "name_value" @@ -2310,6 +2340,7 @@ def test_update_build_trigger( ) as call: # Designate an appropriate return value for the call. call.return_value = cloudbuild.BuildTrigger( + resource_name="resource_name_value", id="id_value", description="description_value", name="name_value", @@ -2318,7 +2349,7 @@ def test_update_build_trigger( ignored_files=["ignored_files_value"], included_files=["included_files_value"], filter="filter_value", - build=cloudbuild.Build(name="name_value"), + autodetect=True, ) response = client.update_build_trigger(request) @@ -2329,6 +2360,7 @@ def test_update_build_trigger( # Establish that the response is the type that we expect. assert isinstance(response, cloudbuild.BuildTrigger) + assert response.resource_name == "resource_name_value" assert response.id == "id_value" assert response.description == "description_value" assert response.name == "name_value" @@ -2379,6 +2411,7 @@ async def test_update_build_trigger_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( cloudbuild.BuildTrigger( + resource_name="resource_name_value", id="id_value", description="description_value", name="name_value", @@ -2398,6 +2431,7 @@ async def test_update_build_trigger_async( # Establish that the response is the type that we expect. assert isinstance(response, cloudbuild.BuildTrigger) + assert response.resource_name == "resource_name_value" assert response.id == "id_value" assert response.description == "description_value" assert response.name == "name_value" @@ -2427,7 +2461,7 @@ def test_update_build_trigger_flattened(): client.update_build_trigger( project_id="project_id_value", trigger_id="trigger_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) # Establish that the underlying call was made with the expected @@ -2436,7 +2470,9 @@ def test_update_build_trigger_flattened(): _, args, _ = call.mock_calls[0] assert args[0].project_id == "project_id_value" assert args[0].trigger_id == "trigger_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + assert args[0].trigger == cloudbuild.BuildTrigger( + resource_name="resource_name_value" + ) def test_update_build_trigger_flattened_error(): @@ -2449,7 +2485,7 @@ def test_update_build_trigger_flattened_error(): cloudbuild.UpdateBuildTriggerRequest(), project_id="project_id_value", trigger_id="trigger_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) @@ -2472,7 +2508,7 @@ async def test_update_build_trigger_flattened_async(): response = await client.update_build_trigger( project_id="project_id_value", trigger_id="trigger_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) # Establish that the underlying call was made with the expected @@ -2481,7 +2517,9 @@ async def test_update_build_trigger_flattened_async(): _, args, _ = call.mock_calls[0] assert args[0].project_id == "project_id_value" assert args[0].trigger_id == "trigger_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + assert args[0].trigger == cloudbuild.BuildTrigger( + resource_name="resource_name_value" + ) @pytest.mark.asyncio @@ -2495,7 +2533,7 @@ async def test_update_build_trigger_flattened_error_async(): cloudbuild.UpdateBuildTriggerRequest(), project_id="project_id_value", trigger_id="trigger_id_value", - trigger=cloudbuild.BuildTrigger(id="id_value"), + trigger=cloudbuild.BuildTrigger(resource_name="resource_name_value"), ) @@ -3539,7 +3577,7 @@ def test_cloud_build_grpc_transport_client_cert_source_for_mtls(transport_class) "squid.clam.whelk:443", credentials=cred, credentials_file=None, - scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, ssl_credentials=mock_ssl_channel_creds, quota_project_id=None, options=[ @@ -3643,7 +3681,7 @@ def test_cloud_build_transport_channel_mtls_with_client_cert_source(transport_cl "mtls.squid.clam.whelk:443", credentials=cred, credentials_file=None, - scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[ @@ -3687,7 +3725,7 @@ def test_cloud_build_transport_channel_mtls_with_adc(transport_class): "mtls.squid.clam.whelk:443", credentials=mock_cred, credentials_file=None, - scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, ssl_credentials=mock_ssl_cred, quota_project_id=None, options=[