diff --git a/docs/assuredworkloads_v1beta1/types.rst b/docs/assuredworkloads_v1beta1/types.rst index 1f0b5f3..070395b 100644 --- a/docs/assuredworkloads_v1beta1/types.rst +++ b/docs/assuredworkloads_v1beta1/types.rst @@ -3,3 +3,4 @@ Types for Google Cloud Assuredworkloads v1beta1 API .. automodule:: google.cloud.assuredworkloads_v1beta1.types :members: + :show-inheritance: diff --git a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py index 8ae4a4d..d122754 100644 --- a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py +++ b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py @@ -28,8 +28,8 @@ from google.auth import credentials # type: ignore from google.oauth2 import service_account # type: ignore -from google.api_core import operation -from google.api_core import operation_async +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore from google.cloud.assuredworkloads_v1beta1.services.assured_workloads_service import ( pagers, ) @@ -55,9 +55,51 @@ class AssuredWorkloadsServiceAsyncClient: AssuredWorkloadsServiceClient.parse_workload_path ) + common_billing_account_path = staticmethod( + AssuredWorkloadsServiceClient.common_billing_account_path + ) + parse_common_billing_account_path = staticmethod( + AssuredWorkloadsServiceClient.parse_common_billing_account_path + ) + + common_folder_path = staticmethod(AssuredWorkloadsServiceClient.common_folder_path) + parse_common_folder_path = staticmethod( + AssuredWorkloadsServiceClient.parse_common_folder_path + ) + + common_organization_path = staticmethod( + AssuredWorkloadsServiceClient.common_organization_path + ) + parse_common_organization_path = staticmethod( + AssuredWorkloadsServiceClient.parse_common_organization_path + ) + + common_project_path = staticmethod( + AssuredWorkloadsServiceClient.common_project_path + ) + parse_common_project_path = staticmethod( + AssuredWorkloadsServiceClient.parse_common_project_path + ) + + common_location_path = staticmethod( + AssuredWorkloadsServiceClient.common_location_path + ) + parse_common_location_path = staticmethod( + AssuredWorkloadsServiceClient.parse_common_location_path + ) + from_service_account_file = AssuredWorkloadsServiceClient.from_service_account_file from_service_account_json = from_service_account_file + @property + def transport(self) -> AssuredWorkloadsServiceTransport: + """Return the transport used by the client instance. + + Returns: + AssuredWorkloadsServiceTransport: The transport used by the client instance. + """ + return self._client.transport + get_transport_class = functools.partial( type(AssuredWorkloadsServiceClient).get_transport_class, type(AssuredWorkloadsServiceClient), @@ -158,7 +200,8 @@ async def create_workload( # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - if request is not None and any([parent, workload]): + has_flattened_params = any([parent, workload]) + if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." @@ -251,7 +294,8 @@ async def update_workload( # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - if request is not None and any([workload, update_mask]): + has_flattened_params = any([workload, update_mask]) + if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." @@ -322,7 +366,8 @@ async def delete_workload( # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - if request is not None and any([name]): + has_flattened_params = any([name]) + if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." @@ -402,7 +447,8 @@ async def get_workload( # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - if request is not None and any([name]): + has_flattened_params = any([name]) + if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." @@ -482,7 +528,8 @@ async def list_workloads( # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - if request is not None and any([parent]): + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." diff --git a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/client.py b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/client.py index 9347be2..de6ee16 100644 --- a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/client.py +++ b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/client.py @@ -19,10 +19,10 @@ from distutils import util import os import re -from typing import Callable, Dict, Sequence, Tuple, Type, Union +from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import client_options as client_options_lib # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore @@ -32,8 +32,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -from google.api_core import operation -from google.api_core import operation_async +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore from google.cloud.assuredworkloads_v1beta1.services.assured_workloads_service import ( pagers, ) @@ -138,6 +138,15 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @property + def transport(self) -> AssuredWorkloadsServiceTransport: + """Return the transport used by the client instance. + + Returns: + AssuredWorkloadsServiceTransport: The transport used by the client instance. + """ + return self._transport + @staticmethod def workload_path(organization: str, location: str, workload: str,) -> str: """Return a fully-qualified workload string.""" @@ -154,12 +163,71 @@ def parse_workload_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def common_billing_account_path(billing_account: str,) -> str: + """Return a fully-qualified billing_account string.""" + return "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + + @staticmethod + def parse_common_billing_account_path(path: str) -> Dict[str, str]: + """Parse a billing_account path into its component segments.""" + m = re.match(r"^billingAccounts/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_folder_path(folder: str,) -> str: + """Return a fully-qualified folder string.""" + return "folders/{folder}".format(folder=folder,) + + @staticmethod + def parse_common_folder_path(path: str) -> Dict[str, str]: + """Parse a folder path into its component segments.""" + m = re.match(r"^folders/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_organization_path(organization: str,) -> str: + """Return a fully-qualified organization string.""" + return "organizations/{organization}".format(organization=organization,) + + @staticmethod + def parse_common_organization_path(path: str) -> Dict[str, str]: + """Parse a organization path into its component segments.""" + m = re.match(r"^organizations/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_project_path(project: str,) -> str: + """Return a fully-qualified project string.""" + return "projects/{project}".format(project=project,) + + @staticmethod + def parse_common_project_path(path: str) -> Dict[str, str]: + """Parse a project path into its component segments.""" + m = re.match(r"^projects/(?P.+?)$", path) + return m.groupdict() if m else {} + + @staticmethod + def common_location_path(project: str, location: str,) -> str: + """Return a fully-qualified location string.""" + return "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + + @staticmethod + def parse_common_location_path(path: str) -> Dict[str, str]: + """Parse a location path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) + return m.groupdict() if m else {} + def __init__( self, *, - credentials: credentials.Credentials = None, - transport: Union[str, AssuredWorkloadsServiceTransport] = None, - client_options: ClientOptions = None, + credentials: Optional[credentials.Credentials] = None, + transport: Union[str, AssuredWorkloadsServiceTransport, None] = None, + client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the assured workloads service client. @@ -173,8 +241,8 @@ def __init__( transport (Union[str, ~.AssuredWorkloadsServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (ClientOptions): Custom options for the client. It - won't take effect if a ``transport`` instance is provided. + client_options (client_options_lib.ClientOptions): Custom options for the + client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT environment variable can also be used to override the endpoint: @@ -189,10 +257,10 @@ def __init__( not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + 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. Raises: @@ -200,9 +268,9 @@ def __init__( creation failed for any reason. """ if isinstance(client_options, dict): - client_options = ClientOptions.from_dict(client_options) + client_options = client_options_lib.from_dict(client_options) if client_options is None: - client_options = ClientOptions.ClientOptions() + client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. use_client_cert = bool( diff --git a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc.py b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc.py index b16553b..f7eeb85 100644 --- a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc.py +++ b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc.py @@ -92,10 +92,10 @@ def __init__( for grpc channel. It is ignored if ``channel`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + 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. Raises: @@ -104,6 +104,8 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._ssl_channel_credentials = ssl_channel_credentials + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -111,6 +113,7 @@ def __init__( # If a channel was explicitly provided, set it. self._grpc_channel = channel + self._ssl_channel_credentials = None elif api_mtls_endpoint: warnings.warn( "api_mtls_endpoint and client_cert_source are deprecated", @@ -147,6 +150,7 @@ def __init__( scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, ) + self._ssl_channel_credentials = ssl_credentials else: host = host if ":" in host else host + ":443" @@ -224,12 +228,8 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Create the channel designed to connect to this service. - - This property caches on the instance; repeated calls return - the same channel. + """Return the channel designed to connect to this service. """ - # Return the channel from cache. return self._grpc_channel @property diff --git a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc_asyncio.py b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc_asyncio.py index b8ba2d0..f353f61 100644 --- a/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc_asyncio.py +++ b/google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc_asyncio.py @@ -149,6 +149,8 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._ssl_channel_credentials = ssl_channel_credentials + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -156,6 +158,7 @@ def __init__( # If a channel was explicitly provided, set it. self._grpc_channel = channel + self._ssl_channel_credentials = None elif api_mtls_endpoint: warnings.warn( "api_mtls_endpoint and client_cert_source are deprecated", @@ -192,6 +195,7 @@ def __init__( scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, ) + self._ssl_channel_credentials = ssl_credentials else: host = host if ":" in host else host + ":443" diff --git a/google/cloud/assuredworkloads_v1beta1/types/assuredworkloads_v1beta1.py b/google/cloud/assuredworkloads_v1beta1/types/assuredworkloads_v1beta1.py index 16f88c8..608ceda 100644 --- a/google/cloud/assuredworkloads_v1beta1/types/assuredworkloads_v1beta1.py +++ b/google/cloud/assuredworkloads_v1beta1/types/assuredworkloads_v1beta1.py @@ -180,8 +180,8 @@ class Workload(proto.Message): the Workload. When present it must be between 4 to 30 characters. Allowed characters are: lowercase and uppercase letters, numbers, - hyphen, single-quote, double-quote, space, and - exclamation point. + hyphen, and spaces. + Example: My Workload resources (Sequence[~.assuredworkloads_v1beta1.Workload.ResourceInfo]): Output only. The resources associated with @@ -224,6 +224,18 @@ class Workload(proto.Message): operations. labels (Sequence[~.assuredworkloads_v1beta1.Workload.LabelsEntry]): Optional. Labels applied to the workload. + provisioned_resources_parent (str): + Input only. The parent resource for the resources managed by + this Assured Workload. May be either an organization or a + folder. Must be the same or a child of the Workload parent. + If not specified all resources are created under the + Workload parent. Formats: folders/{folder_id} + organizations/{organization_id} + kms_settings (~.assuredworkloads_v1beta1.Workload.KMSSettings): + Input only. Settings used to create a CMEK + crypto key. When set a project with a KMS CMEK + key is provisioned. This field is mandatory for + a subset of Compliance Regimes. """ class ComplianceRegime(proto.Enum): @@ -377,6 +389,10 @@ class FedrampModerateSettings(proto.Message): labels = proto.MapField(proto.STRING, proto.STRING, number=10) + provisioned_resources_parent = proto.Field(proto.STRING, number=13) + + kms_settings = proto.Field(proto.MESSAGE, number=14, message=KMSSettings,) + class CreateWorkloadOperationMetadata(proto.Message): r"""Operation metadata to give request details of CreateWorkload. @@ -402,7 +418,7 @@ class CreateWorkloadOperationMetadata(proto.Message): parent = proto.Field(proto.STRING, number=3) compliance_regime = proto.Field( - proto.ENUM, number=4, enum=Workload.ComplianceRegime, + proto.ENUM, number=4, enum="Workload.ComplianceRegime", ) diff --git a/noxfile.py b/noxfile.py index ee702b8..58a86ba 100644 --- a/noxfile.py +++ b/noxfile.py @@ -28,7 +28,7 @@ DEFAULT_PYTHON_VERSION = "3.8" SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] @nox.session(python=DEFAULT_PYTHON_VERSION) diff --git a/synth.metadata b/synth.metadata index 0b4797c..c79ffb5 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,7 +3,16 @@ { "git": { "name": ".", - "remote": "sso://devrel/cloud/libraries/python/python-assured-workloads" + "remote": "https://github.com/googleapis/python-assured-workloads.git", + "sha": "c1542b2ca4b224fdeb8baea8a7f0ec206db3d1aa" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "3ac5ef0436d8dfeb2ca0091dc7fa8012da1c85af", + "internalRef": "342835449" } }, { @@ -31,5 +40,90 @@ "generator": "bazel" } } + ], + "generatedFiles": [ + ".flake8", + ".github/CONTRIBUTING.md", + ".github/ISSUE_TEMPLATE/bug_report.md", + ".github/ISSUE_TEMPLATE/feature_request.md", + ".github/ISSUE_TEMPLATE/support_request.md", + ".github/PULL_REQUEST_TEMPLATE.md", + ".github/release-please.yml", + ".github/snippet-bot.yml", + ".gitignore", + ".kokoro/build.sh", + ".kokoro/continuous/common.cfg", + ".kokoro/continuous/continuous.cfg", + ".kokoro/docker/docs/Dockerfile", + ".kokoro/docker/docs/fetch_gpg_keys.sh", + ".kokoro/docs/common.cfg", + ".kokoro/docs/docs-presubmit.cfg", + ".kokoro/docs/docs.cfg", + ".kokoro/populate-secrets.sh", + ".kokoro/presubmit/common.cfg", + ".kokoro/presubmit/presubmit.cfg", + ".kokoro/publish-docs.sh", + ".kokoro/release.sh", + ".kokoro/release/common.cfg", + ".kokoro/release/release.cfg", + ".kokoro/samples/lint/common.cfg", + ".kokoro/samples/lint/continuous.cfg", + ".kokoro/samples/lint/periodic.cfg", + ".kokoro/samples/lint/presubmit.cfg", + ".kokoro/samples/python3.6/common.cfg", + ".kokoro/samples/python3.6/continuous.cfg", + ".kokoro/samples/python3.6/periodic.cfg", + ".kokoro/samples/python3.6/presubmit.cfg", + ".kokoro/samples/python3.7/common.cfg", + ".kokoro/samples/python3.7/continuous.cfg", + ".kokoro/samples/python3.7/periodic.cfg", + ".kokoro/samples/python3.7/presubmit.cfg", + ".kokoro/samples/python3.8/common.cfg", + ".kokoro/samples/python3.8/continuous.cfg", + ".kokoro/samples/python3.8/periodic.cfg", + ".kokoro/samples/python3.8/presubmit.cfg", + ".kokoro/test-samples.sh", + ".kokoro/trampoline.sh", + ".kokoro/trampoline_v2.sh", + ".trampolinerc", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.rst", + "LICENSE", + "MANIFEST.in", + "docs/_static/custom.css", + "docs/_templates/layout.html", + "docs/assuredworkloads_v1beta1/services.rst", + "docs/assuredworkloads_v1beta1/types.rst", + "docs/conf.py", + "docs/multiprocessing.rst", + "google/cloud/assuredworkloads/__init__.py", + "google/cloud/assuredworkloads/py.typed", + "google/cloud/assuredworkloads_v1beta1/__init__.py", + "google/cloud/assuredworkloads_v1beta1/py.typed", + "google/cloud/assuredworkloads_v1beta1/services/__init__.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/__init__.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/async_client.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/client.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/pagers.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/__init__.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/base.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc.py", + "google/cloud/assuredworkloads_v1beta1/services/assured_workloads_service/transports/grpc_asyncio.py", + "google/cloud/assuredworkloads_v1beta1/types/__init__.py", + "google/cloud/assuredworkloads_v1beta1/types/assuredworkloads_v1beta1.py", + "mypy.ini", + "noxfile.py", + "renovate.json", + "scripts/decrypt-secrets.sh", + "scripts/readme-gen/readme_gen.py", + "scripts/readme-gen/templates/README.tmpl.rst", + "scripts/readme-gen/templates/auth.tmpl.rst", + "scripts/readme-gen/templates/auth_api_key.tmpl.rst", + "scripts/readme-gen/templates/install_deps.tmpl.rst", + "scripts/readme-gen/templates/install_portaudio.tmpl.rst", + "setup.cfg", + "testing/.gitignore", + "tests/unit/gapic/assuredworkloads_v1beta1/__init__.py", + "tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py" ] } \ No newline at end of file diff --git a/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py b/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py index 7f24f6f..24aa261 100644 --- a/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py +++ b/tests/unit/gapic/assuredworkloads_v1beta1/test_assured_workloads_service.py @@ -31,7 +31,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async -from google.api_core import operation_async +from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 from google.auth import credentials from google.auth.exceptions import MutualTLSChannelError @@ -110,12 +110,12 @@ def test_assured_workloads_service_client_from_service_account_file(client_class ) as factory: factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") - assert client._transport._credentials == creds + assert client.transport._credentials == creds client = client_class.from_service_account_json("dummy/file/path.json") - assert client._transport._credentials == creds + assert client.transport._credentials == creds - assert client._transport._host == "assuredworkloads.googleapis.com:443" + assert client.transport._host == "assuredworkloads.googleapis.com:443" def test_assured_workloads_service_client_get_transport_class(): @@ -487,7 +487,7 @@ def test_create_workload( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.create_workload), "__call__") as call: + with mock.patch.object(type(client.transport.create_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/spam") @@ -508,19 +508,20 @@ def test_create_workload_from_dict(): @pytest.mark.asyncio -async def test_create_workload_async(transport: str = "grpc_asyncio"): +async def test_create_workload_async( + transport: str = "grpc_asyncio", + request_type=assuredworkloads_v1beta1.CreateWorkloadRequest, +): client = AssuredWorkloadsServiceAsyncClient( credentials=credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = assuredworkloads_v1beta1.CreateWorkloadRequest() + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.create_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/spam") @@ -532,12 +533,17 @@ async def test_create_workload_async(transport: str = "grpc_asyncio"): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == request + assert args[0] == assuredworkloads_v1beta1.CreateWorkloadRequest() # Establish that the response is the type that we expect. assert isinstance(response, future.Future) +@pytest.mark.asyncio +async def test_create_workload_async_from_dict(): + await test_create_workload_async(request_type=dict) + + def test_create_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=credentials.AnonymousCredentials(), @@ -549,7 +555,7 @@ def test_create_workload_field_headers(): request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.create_workload), "__call__") as call: + with mock.patch.object(type(client.transport.create_workload), "__call__") as call: call.return_value = operations_pb2.Operation(name="operations/op") client.create_workload(request) @@ -576,9 +582,7 @@ async def test_create_workload_field_headers_async(): request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.create_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_workload), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( operations_pb2.Operation(name="operations/op") ) @@ -601,7 +605,7 @@ def test_create_workload_flattened(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.create_workload), "__call__") as call: + with mock.patch.object(type(client.transport.create_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") @@ -644,9 +648,7 @@ async def test_create_workload_flattened_async(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.create_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = operations_pb2.Operation(name="operations/op") @@ -698,7 +700,7 @@ def test_update_workload( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.update_workload), "__call__") as call: + with mock.patch.object(type(client.transport.update_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.Workload( name="name_value", @@ -706,6 +708,7 @@ def test_update_workload( compliance_regime=assuredworkloads_v1beta1.Workload.ComplianceRegime.IL4, billing_account="billing_account_value", etag="etag_value", + provisioned_resources_parent="provisioned_resources_parent_value", il4_settings=assuredworkloads_v1beta1.Workload.IL4Settings( kms_settings=assuredworkloads_v1beta1.Workload.KMSSettings( next_rotation_time=timestamp.Timestamp(seconds=751) @@ -722,6 +725,7 @@ def test_update_workload( assert args[0] == assuredworkloads_v1beta1.UpdateWorkloadRequest() # Establish that the response is the type that we expect. + assert isinstance(response, assuredworkloads_v1beta1.Workload) assert response.name == "name_value" @@ -737,25 +741,28 @@ def test_update_workload( assert response.etag == "etag_value" + assert response.provisioned_resources_parent == "provisioned_resources_parent_value" + def test_update_workload_from_dict(): test_update_workload(request_type=dict) @pytest.mark.asyncio -async def test_update_workload_async(transport: str = "grpc_asyncio"): +async def test_update_workload_async( + transport: str = "grpc_asyncio", + request_type=assuredworkloads_v1beta1.UpdateWorkloadRequest, +): client = AssuredWorkloadsServiceAsyncClient( credentials=credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = assuredworkloads_v1beta1.UpdateWorkloadRequest() + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.update_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( assuredworkloads_v1beta1.Workload( @@ -764,6 +771,7 @@ async def test_update_workload_async(transport: str = "grpc_asyncio"): compliance_regime=assuredworkloads_v1beta1.Workload.ComplianceRegime.IL4, billing_account="billing_account_value", etag="etag_value", + provisioned_resources_parent="provisioned_resources_parent_value", ) ) @@ -773,7 +781,7 @@ async def test_update_workload_async(transport: str = "grpc_asyncio"): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == request + assert args[0] == assuredworkloads_v1beta1.UpdateWorkloadRequest() # Establish that the response is the type that we expect. assert isinstance(response, assuredworkloads_v1beta1.Workload) @@ -791,6 +799,13 @@ async def test_update_workload_async(transport: str = "grpc_asyncio"): assert response.etag == "etag_value" + assert response.provisioned_resources_parent == "provisioned_resources_parent_value" + + +@pytest.mark.asyncio +async def test_update_workload_async_from_dict(): + await test_update_workload_async(request_type=dict) + def test_update_workload_field_headers(): client = AssuredWorkloadsServiceClient( @@ -803,7 +818,7 @@ def test_update_workload_field_headers(): request.workload.name = "workload.name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.update_workload), "__call__") as call: + with mock.patch.object(type(client.transport.update_workload), "__call__") as call: call.return_value = assuredworkloads_v1beta1.Workload() client.update_workload(request) @@ -832,9 +847,7 @@ async def test_update_workload_field_headers_async(): request.workload.name = "workload.name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.update_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_workload), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( assuredworkloads_v1beta1.Workload() ) @@ -859,7 +872,7 @@ def test_update_workload_flattened(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.update_workload), "__call__") as call: + with mock.patch.object(type(client.transport.update_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.Workload() @@ -902,9 +915,7 @@ async def test_update_workload_flattened_async(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.update_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.Workload() @@ -956,7 +967,7 @@ def test_delete_workload( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.delete_workload), "__call__") as call: + with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None @@ -977,19 +988,20 @@ def test_delete_workload_from_dict(): @pytest.mark.asyncio -async def test_delete_workload_async(transport: str = "grpc_asyncio"): +async def test_delete_workload_async( + transport: str = "grpc_asyncio", + request_type=assuredworkloads_v1beta1.DeleteWorkloadRequest, +): client = AssuredWorkloadsServiceAsyncClient( credentials=credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = assuredworkloads_v1beta1.DeleteWorkloadRequest() + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.delete_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) @@ -999,12 +1011,17 @@ async def test_delete_workload_async(transport: str = "grpc_asyncio"): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == request + assert args[0] == assuredworkloads_v1beta1.DeleteWorkloadRequest() # Establish that the response is the type that we expect. assert response is None +@pytest.mark.asyncio +async def test_delete_workload_async_from_dict(): + await test_delete_workload_async(request_type=dict) + + def test_delete_workload_field_headers(): client = AssuredWorkloadsServiceClient( credentials=credentials.AnonymousCredentials(), @@ -1016,7 +1033,7 @@ def test_delete_workload_field_headers(): request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.delete_workload), "__call__") as call: + with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: call.return_value = None client.delete_workload(request) @@ -1043,9 +1060,7 @@ async def test_delete_workload_field_headers_async(): request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.delete_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) await client.delete_workload(request) @@ -1066,7 +1081,7 @@ def test_delete_workload_flattened(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.delete_workload), "__call__") as call: + with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None @@ -1102,9 +1117,7 @@ async def test_delete_workload_flattened_async(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.delete_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.delete_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = None @@ -1147,7 +1160,7 @@ def test_get_workload( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.get_workload), "__call__") as call: + with mock.patch.object(type(client.transport.get_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.Workload( name="name_value", @@ -1155,6 +1168,7 @@ def test_get_workload( compliance_regime=assuredworkloads_v1beta1.Workload.ComplianceRegime.IL4, billing_account="billing_account_value", etag="etag_value", + provisioned_resources_parent="provisioned_resources_parent_value", il4_settings=assuredworkloads_v1beta1.Workload.IL4Settings( kms_settings=assuredworkloads_v1beta1.Workload.KMSSettings( next_rotation_time=timestamp.Timestamp(seconds=751) @@ -1171,6 +1185,7 @@ def test_get_workload( assert args[0] == assuredworkloads_v1beta1.GetWorkloadRequest() # Establish that the response is the type that we expect. + assert isinstance(response, assuredworkloads_v1beta1.Workload) assert response.name == "name_value" @@ -1186,25 +1201,28 @@ def test_get_workload( assert response.etag == "etag_value" + assert response.provisioned_resources_parent == "provisioned_resources_parent_value" + def test_get_workload_from_dict(): test_get_workload(request_type=dict) @pytest.mark.asyncio -async def test_get_workload_async(transport: str = "grpc_asyncio"): +async def test_get_workload_async( + transport: str = "grpc_asyncio", + request_type=assuredworkloads_v1beta1.GetWorkloadRequest, +): client = AssuredWorkloadsServiceAsyncClient( credentials=credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = assuredworkloads_v1beta1.GetWorkloadRequest() + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.get_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( assuredworkloads_v1beta1.Workload( @@ -1213,6 +1231,7 @@ async def test_get_workload_async(transport: str = "grpc_asyncio"): compliance_regime=assuredworkloads_v1beta1.Workload.ComplianceRegime.IL4, billing_account="billing_account_value", etag="etag_value", + provisioned_resources_parent="provisioned_resources_parent_value", ) ) @@ -1222,7 +1241,7 @@ async def test_get_workload_async(transport: str = "grpc_asyncio"): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == request + assert args[0] == assuredworkloads_v1beta1.GetWorkloadRequest() # Establish that the response is the type that we expect. assert isinstance(response, assuredworkloads_v1beta1.Workload) @@ -1240,6 +1259,13 @@ async def test_get_workload_async(transport: str = "grpc_asyncio"): assert response.etag == "etag_value" + assert response.provisioned_resources_parent == "provisioned_resources_parent_value" + + +@pytest.mark.asyncio +async def test_get_workload_async_from_dict(): + await test_get_workload_async(request_type=dict) + def test_get_workload_field_headers(): client = AssuredWorkloadsServiceClient( @@ -1252,7 +1278,7 @@ def test_get_workload_field_headers(): request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.get_workload), "__call__") as call: + with mock.patch.object(type(client.transport.get_workload), "__call__") as call: call.return_value = assuredworkloads_v1beta1.Workload() client.get_workload(request) @@ -1279,9 +1305,7 @@ async def test_get_workload_field_headers_async(): request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.get_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_workload), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( assuredworkloads_v1beta1.Workload() ) @@ -1304,7 +1328,7 @@ def test_get_workload_flattened(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.get_workload), "__call__") as call: + with mock.patch.object(type(client.transport.get_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.Workload() @@ -1340,9 +1364,7 @@ async def test_get_workload_flattened_async(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.get_workload), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_workload), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.Workload() @@ -1387,7 +1409,7 @@ def test_list_workloads( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.list_workloads), "__call__") as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.ListWorkloadsResponse( next_page_token="next_page_token_value", @@ -1402,6 +1424,7 @@ def test_list_workloads( assert args[0] == assuredworkloads_v1beta1.ListWorkloadsRequest() # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListWorkloadsPager) assert response.next_page_token == "next_page_token_value" @@ -1412,19 +1435,20 @@ def test_list_workloads_from_dict(): @pytest.mark.asyncio -async def test_list_workloads_async(transport: str = "grpc_asyncio"): +async def test_list_workloads_async( + transport: str = "grpc_asyncio", + request_type=assuredworkloads_v1beta1.ListWorkloadsRequest, +): client = AssuredWorkloadsServiceAsyncClient( credentials=credentials.AnonymousCredentials(), transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. - request = assuredworkloads_v1beta1.ListWorkloadsRequest() + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.list_workloads), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( assuredworkloads_v1beta1.ListWorkloadsResponse( @@ -1438,7 +1462,7 @@ async def test_list_workloads_async(transport: str = "grpc_asyncio"): assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == request + assert args[0] == assuredworkloads_v1beta1.ListWorkloadsRequest() # Establish that the response is the type that we expect. assert isinstance(response, pagers.ListWorkloadsAsyncPager) @@ -1446,6 +1470,11 @@ async def test_list_workloads_async(transport: str = "grpc_asyncio"): assert response.next_page_token == "next_page_token_value" +@pytest.mark.asyncio +async def test_list_workloads_async_from_dict(): + await test_list_workloads_async(request_type=dict) + + def test_list_workloads_field_headers(): client = AssuredWorkloadsServiceClient( credentials=credentials.AnonymousCredentials(), @@ -1457,7 +1486,7 @@ def test_list_workloads_field_headers(): request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.list_workloads), "__call__") as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: call.return_value = assuredworkloads_v1beta1.ListWorkloadsResponse() client.list_workloads(request) @@ -1484,9 +1513,7 @@ async def test_list_workloads_field_headers_async(): request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.list_workloads), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( assuredworkloads_v1beta1.ListWorkloadsResponse() ) @@ -1509,7 +1536,7 @@ def test_list_workloads_flattened(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.list_workloads), "__call__") as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.ListWorkloadsResponse() @@ -1545,9 +1572,7 @@ async def test_list_workloads_flattened_async(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client._client._transport.list_workloads), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = assuredworkloads_v1beta1.ListWorkloadsResponse() @@ -1586,7 +1611,7 @@ def test_list_workloads_pager(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.list_workloads), "__call__") as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( assuredworkloads_v1beta1.ListWorkloadsResponse( @@ -1631,7 +1656,7 @@ def test_list_workloads_pages(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client._transport.list_workloads), "__call__") as call: + with mock.patch.object(type(client.transport.list_workloads), "__call__") as call: # Set the response to a series of pages. call.side_effect = ( assuredworkloads_v1beta1.ListWorkloadsResponse( @@ -1669,9 +1694,7 @@ async def test_list_workloads_async_pager(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client._client._transport.list_workloads), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.list_workloads), "__call__", new_callable=mock.AsyncMock ) as call: # Set the response to a series of pages. call.side_effect = ( @@ -1715,9 +1738,7 @@ async def test_list_workloads_async_pages(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client._client._transport.list_workloads), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.list_workloads), "__call__", new_callable=mock.AsyncMock ) as call: # Set the response to a series of pages. call.side_effect = ( @@ -1786,7 +1807,7 @@ def test_transport_instance(): credentials=credentials.AnonymousCredentials(), ) client = AssuredWorkloadsServiceClient(transport=transport) - assert client._transport is transport + assert client.transport is transport def test_transport_get_channel(): @@ -1825,7 +1846,7 @@ def test_transport_grpc_default(): credentials=credentials.AnonymousCredentials(), ) assert isinstance( - client._transport, transports.AssuredWorkloadsServiceGrpcTransport, + client.transport, transports.AssuredWorkloadsServiceGrpcTransport, ) @@ -1929,7 +1950,7 @@ def test_assured_workloads_service_host_no_port(): api_endpoint="assuredworkloads.googleapis.com" ), ) - assert client._transport._host == "assuredworkloads.googleapis.com:443" + assert client.transport._host == "assuredworkloads.googleapis.com:443" def test_assured_workloads_service_host_with_port(): @@ -1939,7 +1960,7 @@ def test_assured_workloads_service_host_with_port(): api_endpoint="assuredworkloads.googleapis.com:8000" ), ) - assert client._transport._host == "assuredworkloads.googleapis.com:8000" + assert client.transport._host == "assuredworkloads.googleapis.com:8000" def test_assured_workloads_service_grpc_transport_channel(): @@ -1951,6 +1972,7 @@ def test_assured_workloads_service_grpc_transport_channel(): ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None def test_assured_workloads_service_grpc_asyncio_transport_channel(): @@ -1962,6 +1984,7 @@ def test_assured_workloads_service_grpc_asyncio_transport_channel(): ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" + assert transport._ssl_channel_credentials == None @pytest.mark.parametrize( @@ -2009,6 +2032,7 @@ def test_assured_workloads_service_transport_channel_mtls_with_client_cert_sourc quota_project_id=None, ) assert transport.grpc_channel == mock_grpc_channel + assert transport._ssl_channel_credentials == mock_ssl_cred @pytest.mark.parametrize( @@ -2055,7 +2079,7 @@ def test_assured_workloads_service_grpc_lro_client(): client = AssuredWorkloadsServiceClient( credentials=credentials.AnonymousCredentials(), transport="grpc", ) - transport = client._transport + transport = client.transport # Ensure that we have a api-core operations client. assert isinstance(transport.operations_client, operations_v1.OperationsClient,) @@ -2068,7 +2092,7 @@ def test_assured_workloads_service_grpc_lro_async_client(): client = AssuredWorkloadsServiceAsyncClient( credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", ) - transport = client._client._transport + transport = client.transport # Ensure that we have a api-core operations client. assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) @@ -2104,6 +2128,107 @@ def test_parse_workload_path(): assert expected == actual +def test_common_billing_account_path(): + billing_account = "cuttlefish" + + expected = "billingAccounts/{billing_account}".format( + billing_account=billing_account, + ) + actual = AssuredWorkloadsServiceClient.common_billing_account_path(billing_account) + assert expected == actual + + +def test_parse_common_billing_account_path(): + expected = { + "billing_account": "mussel", + } + path = AssuredWorkloadsServiceClient.common_billing_account_path(**expected) + + # Check that the path construction is reversible. + actual = AssuredWorkloadsServiceClient.parse_common_billing_account_path(path) + assert expected == actual + + +def test_common_folder_path(): + folder = "winkle" + + expected = "folders/{folder}".format(folder=folder,) + actual = AssuredWorkloadsServiceClient.common_folder_path(folder) + assert expected == actual + + +def test_parse_common_folder_path(): + expected = { + "folder": "nautilus", + } + path = AssuredWorkloadsServiceClient.common_folder_path(**expected) + + # Check that the path construction is reversible. + actual = AssuredWorkloadsServiceClient.parse_common_folder_path(path) + assert expected == actual + + +def test_common_organization_path(): + organization = "scallop" + + expected = "organizations/{organization}".format(organization=organization,) + actual = AssuredWorkloadsServiceClient.common_organization_path(organization) + assert expected == actual + + +def test_parse_common_organization_path(): + expected = { + "organization": "abalone", + } + path = AssuredWorkloadsServiceClient.common_organization_path(**expected) + + # Check that the path construction is reversible. + actual = AssuredWorkloadsServiceClient.parse_common_organization_path(path) + assert expected == actual + + +def test_common_project_path(): + project = "squid" + + expected = "projects/{project}".format(project=project,) + actual = AssuredWorkloadsServiceClient.common_project_path(project) + assert expected == actual + + +def test_parse_common_project_path(): + expected = { + "project": "clam", + } + path = AssuredWorkloadsServiceClient.common_project_path(**expected) + + # Check that the path construction is reversible. + actual = AssuredWorkloadsServiceClient.parse_common_project_path(path) + assert expected == actual + + +def test_common_location_path(): + project = "whelk" + location = "octopus" + + expected = "projects/{project}/locations/{location}".format( + project=project, location=location, + ) + actual = AssuredWorkloadsServiceClient.common_location_path(project, location) + assert expected == actual + + +def test_parse_common_location_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + } + path = AssuredWorkloadsServiceClient.common_location_path(**expected) + + # Check that the path construction is reversible. + actual = AssuredWorkloadsServiceClient.parse_common_location_path(path) + assert expected == actual + + def test_client_withDEFAULT_CLIENT_INFO(): client_info = gapic_v1.client_info.ClientInfo()