diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 98014fb..b668c04 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,17 +1,17 @@ -# Copyright 2021 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 + digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 + diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c7eaf45..fc461db 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,5 @@ # @googleapis/yoshi-python @googleapis/api-compute are the default owners for changes in this repo * @googleapis/yoshi-python @googleapis/api-compute -# @googleapis/python-samples-owners @googleapis/api-compute are the default owners for samples changes -/samples/ @googleapis/python-samples-owners @googleapis/api-compute +# @googleapis/python-samples-reviewers @googleapis/api-compute are the default owners for samples changes +/samples/ @googleapis/python-samples-reviewers @googleapis/api-compute diff --git a/.github/release-please.yml b/.github/release-please.yml index 4507ad0..466597e 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1 +1,2 @@ releaseType: python +handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 0000000..d4ca941 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..f7b8344 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - main +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..1e8b05c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - main +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..074ee25 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - main +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=100 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 2d7e5f8..545b9ed 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") +TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-vm-migration python3 setup.py sdist bdist_wheel twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 93befa5..63829a9 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,8 +23,18 @@ env_vars: { value: "github/python-vm-migration/.kokoro/release.sh" } +# Fetch PyPI password +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google-cloud-pypi-token-keystore-1" + } + } +} + # Tokens needed to report release status back to GitHub env_vars: { key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } diff --git a/.repo-metadata.json b/.repo-metadata.json index 0586ac3..9a1ef2c 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,14 +2,15 @@ "name": "vmmigration", "name_pretty": "Cloud VM Migration", "product_documentation": "https://cloud.google.com/migrate/compute-engine/docs", - "client_documentation": "https://googleapis.dev/python/vmmigration/latest", + "client_documentation": "https://cloud.google.com/python/docs/reference/vmmigration/latest", "issue_tracker": "", - "release_level": "beta", + "release_level": "stable", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-vm-migration", "distribution_name": "google-cloud-vm-migration", "api_id": "vmmigration.googleapis.com", "default_version": "v1", - "codeowner_team": "@googleapis/api-compute" + "codeowner_team": "@googleapis/api-compute", + "api_shortname": "vmmigration" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9418cf2..85c036d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.0.0](https://github.com/googleapis/python-vm-migration/compare/v0.1.0...v1.0.0) (2022-01-24) + + +### Features + +* bump release level to production/stable ([#4](https://github.com/googleapis/python-vm-migration/issues/4)) ([23b4a5e](https://github.com/googleapis/python-vm-migration/commit/23b4a5ef93452580a4587e3d95163fcf664ed39f)) + ## 0.1.0 (2021-11-18) diff --git a/README.rst b/README.rst index d5e47e0..7888cfa 100644 --- a/README.rst +++ b/README.rst @@ -1,14 +1,14 @@ Python Client for Cloud VM Migration ==================================== -|beta| |pypi| |versions| +|stable| |pypi| |versions| `Cloud VM Migration`_: for Compute Engine migrates VMs from your on-premises data center into Compute Engine. - `Client Library Documentation`_ - `Product Documentation`_ -.. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg +.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-vm-migration.svg :target: https://pypi.org/project/google-cloud-vm-migration/ diff --git a/google/cloud/vmmigration_v1/services/vm_migration/transports/base.py b/google/cloud/vmmigration_v1/services/vm_migration/transports/base.py index e8e4c9c..10e9667 100644 --- a/google/cloud/vmmigration_v1/services/vm_migration/transports/base.py +++ b/google/cloud/vmmigration_v1/services/vm_migration/transports/base.py @@ -103,7 +103,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/setup.py b/setup.py index 4c7f48b..69abbe3 100644 --- a/setup.py +++ b/setup.py @@ -22,9 +22,9 @@ name = "google-cloud-vm-migration" description = "Cloud VM Migration API client library" -version = "0.1.0" +version = "1.0.0" url = "https://github.com/googleapis/python-vm-migration" -release_status = "Development Status :: 4 - Beta" +release_status = "Development Status :: 5 - Production/Stable" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed diff --git a/tests/unit/gapic/vmmigration_v1/test_vm_migration.py b/tests/unit/gapic/vmmigration_v1/test_vm_migration.py index 70835fa..7abddc1 100644 --- a/tests/unit/gapic/vmmigration_v1/test_vm_migration.py +++ b/tests/unit/gapic/vmmigration_v1/test_vm_migration.py @@ -246,20 +246,20 @@ def test_vm_migration_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -316,7 +316,7 @@ def test_vm_migration_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -411,7 +411,7 @@ def test_vm_migration_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -442,7 +442,7 @@ def test_vm_migration_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -473,9 +473,8 @@ def test_vm_migration_client_client_options_from_dict(): ) -def test_list_sources( - transport: str = "grpc", request_type=vmmigration.ListSourcesRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ListSourcesRequest, dict,]) +def test_list_sources(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -503,10 +502,6 @@ def test_list_sources( assert response.unreachable == ["unreachable_value"] -def test_list_sources_from_dict(): - test_list_sources(request_type=dict) - - def test_list_sources_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -680,8 +675,10 @@ async def test_list_sources_flattened_error_async(): ) -def test_list_sources_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_sources_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_sources), "__call__") as call: @@ -718,8 +715,10 @@ def test_list_sources_pager(): assert all(isinstance(i, vmmigration.Source) for i in results) -def test_list_sources_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_sources_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_sources), "__call__") as call: @@ -818,7 +817,8 @@ async def test_list_sources_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_source(transport: str = "grpc", request_type=vmmigration.GetSourceRequest): +@pytest.mark.parametrize("request_type", [vmmigration.GetSourceRequest, dict,]) +def test_get_source(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -848,10 +848,6 @@ def test_get_source(transport: str = "grpc", request_type=vmmigration.GetSourceR assert response.description == "description_value" -def test_get_source_from_dict(): - test_get_source(request_type=dict) - - def test_get_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1018,9 +1014,8 @@ async def test_get_source_flattened_error_async(): ) -def test_create_source( - transport: str = "grpc", request_type=vmmigration.CreateSourceRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CreateSourceRequest, dict,]) +def test_create_source(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1044,10 +1039,6 @@ def test_create_source( assert isinstance(response, future.Future) -def test_create_source_from_dict(): - test_create_source(request_type=dict) - - def test_create_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1254,9 +1245,8 @@ async def test_create_source_flattened_error_async(): ) -def test_update_source( - transport: str = "grpc", request_type=vmmigration.UpdateSourceRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.UpdateSourceRequest, dict,]) +def test_update_source(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1280,10 +1270,6 @@ def test_update_source( assert isinstance(response, future.Future) -def test_update_source_from_dict(): - test_update_source(request_type=dict) - - def test_update_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1480,9 +1466,8 @@ async def test_update_source_flattened_error_async(): ) -def test_delete_source( - transport: str = "grpc", request_type=vmmigration.DeleteSourceRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.DeleteSourceRequest, dict,]) +def test_delete_source(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1506,10 +1491,6 @@ def test_delete_source( assert isinstance(response, future.Future) -def test_delete_source_from_dict(): - test_delete_source(request_type=dict) - - def test_delete_source_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1678,9 +1659,8 @@ async def test_delete_source_flattened_error_async(): ) -def test_fetch_inventory( - transport: str = "grpc", request_type=vmmigration.FetchInventoryRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.FetchInventoryRequest, dict,]) +def test_fetch_inventory(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1708,10 +1688,6 @@ def test_fetch_inventory( assert isinstance(response, vmmigration.FetchInventoryResponse) -def test_fetch_inventory_from_dict(): - test_fetch_inventory(request_type=dict) - - def test_fetch_inventory_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1880,9 +1856,10 @@ async def test_fetch_inventory_flattened_error_async(): ) -def test_list_utilization_reports( - transport: str = "grpc", request_type=vmmigration.ListUtilizationReportsRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.ListUtilizationReportsRequest, dict,] +) +def test_list_utilization_reports(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1912,10 +1889,6 @@ def test_list_utilization_reports( assert response.unreachable == ["unreachable_value"] -def test_list_utilization_reports_from_dict(): - test_list_utilization_reports(request_type=dict) - - def test_list_utilization_reports_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2102,8 +2075,10 @@ async def test_list_utilization_reports_flattened_error_async(): ) -def test_list_utilization_reports_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_utilization_reports_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2148,8 +2123,10 @@ def test_list_utilization_reports_pager(): assert all(isinstance(i, vmmigration.UtilizationReport) for i in results) -def test_list_utilization_reports_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_utilization_reports_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2272,9 +2249,10 @@ async def test_list_utilization_reports_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_utilization_report( - transport: str = "grpc", request_type=vmmigration.GetUtilizationReportRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.GetUtilizationReportRequest, dict,] +) +def test_get_utilization_report(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2311,10 +2289,6 @@ def test_get_utilization_report( assert response.vm_count == 875 -def test_get_utilization_report_from_dict(): - test_get_utilization_report(request_type=dict) - - def test_get_utilization_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2507,9 +2481,10 @@ async def test_get_utilization_report_flattened_error_async(): ) -def test_create_utilization_report( - transport: str = "grpc", request_type=vmmigration.CreateUtilizationReportRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.CreateUtilizationReportRequest, dict,] +) +def test_create_utilization_report(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2535,10 +2510,6 @@ def test_create_utilization_report( assert isinstance(response, future.Future) -def test_create_utilization_report_from_dict(): - test_create_utilization_report(request_type=dict) - - def test_create_utilization_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2746,9 +2717,10 @@ async def test_create_utilization_report_flattened_error_async(): ) -def test_delete_utilization_report( - transport: str = "grpc", request_type=vmmigration.DeleteUtilizationReportRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.DeleteUtilizationReportRequest, dict,] +) +def test_delete_utilization_report(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2774,10 +2746,6 @@ def test_delete_utilization_report( assert isinstance(response, future.Future) -def test_delete_utilization_report_from_dict(): - test_delete_utilization_report(request_type=dict) - - def test_delete_utilization_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2959,9 +2927,10 @@ async def test_delete_utilization_report_flattened_error_async(): ) -def test_list_datacenter_connectors( - transport: str = "grpc", request_type=vmmigration.ListDatacenterConnectorsRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.ListDatacenterConnectorsRequest, dict,] +) +def test_list_datacenter_connectors(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2991,10 +2960,6 @@ def test_list_datacenter_connectors( assert response.unreachable == ["unreachable_value"] -def test_list_datacenter_connectors_from_dict(): - test_list_datacenter_connectors(request_type=dict) - - def test_list_datacenter_connectors_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3181,8 +3146,10 @@ async def test_list_datacenter_connectors_flattened_error_async(): ) -def test_list_datacenter_connectors_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_datacenter_connectors_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3227,8 +3194,10 @@ def test_list_datacenter_connectors_pager(): assert all(isinstance(i, vmmigration.DatacenterConnector) for i in results) -def test_list_datacenter_connectors_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_datacenter_connectors_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3351,9 +3320,10 @@ async def test_list_datacenter_connectors_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_datacenter_connector( - transport: str = "grpc", request_type=vmmigration.GetDatacenterConnectorRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.GetDatacenterConnectorRequest, dict,] +) +def test_get_datacenter_connector(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3392,10 +3362,6 @@ def test_get_datacenter_connector( assert response.state == vmmigration.DatacenterConnector.State.PENDING -def test_get_datacenter_connector_from_dict(): - test_get_datacenter_connector(request_type=dict) - - def test_get_datacenter_connector_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3590,9 +3556,10 @@ async def test_get_datacenter_connector_flattened_error_async(): ) -def test_create_datacenter_connector( - transport: str = "grpc", request_type=vmmigration.CreateDatacenterConnectorRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.CreateDatacenterConnectorRequest, dict,] +) +def test_create_datacenter_connector(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3618,10 +3585,6 @@ def test_create_datacenter_connector( assert isinstance(response, future.Future) -def test_create_datacenter_connector_from_dict(): - test_create_datacenter_connector(request_type=dict) - - def test_create_datacenter_connector_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3841,9 +3804,10 @@ async def test_create_datacenter_connector_flattened_error_async(): ) -def test_delete_datacenter_connector( - transport: str = "grpc", request_type=vmmigration.DeleteDatacenterConnectorRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.DeleteDatacenterConnectorRequest, dict,] +) +def test_delete_datacenter_connector(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3869,10 +3833,6 @@ def test_delete_datacenter_connector( assert isinstance(response, future.Future) -def test_delete_datacenter_connector_from_dict(): - test_delete_datacenter_connector(request_type=dict) - - def test_delete_datacenter_connector_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4054,9 +4014,8 @@ async def test_delete_datacenter_connector_flattened_error_async(): ) -def test_create_migrating_vm( - transport: str = "grpc", request_type=vmmigration.CreateMigratingVmRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CreateMigratingVmRequest, dict,]) +def test_create_migrating_vm(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4082,10 +4041,6 @@ def test_create_migrating_vm( assert isinstance(response, future.Future) -def test_create_migrating_vm_from_dict(): - test_create_migrating_vm(request_type=dict) - - def test_create_migrating_vm_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4316,9 +4271,8 @@ async def test_create_migrating_vm_flattened_error_async(): ) -def test_list_migrating_vms( - transport: str = "grpc", request_type=vmmigration.ListMigratingVmsRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ListMigratingVmsRequest, dict,]) +def test_list_migrating_vms(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4348,10 +4302,6 @@ def test_list_migrating_vms( assert response.unreachable == ["unreachable_value"] -def test_list_migrating_vms_from_dict(): - test_list_migrating_vms(request_type=dict) - - def test_list_migrating_vms_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4537,8 +4487,10 @@ async def test_list_migrating_vms_flattened_error_async(): ) -def test_list_migrating_vms_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_migrating_vms_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4579,8 +4531,10 @@ def test_list_migrating_vms_pager(): assert all(isinstance(i, vmmigration.MigratingVm) for i in results) -def test_list_migrating_vms_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_migrating_vms_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4691,9 +4645,8 @@ async def test_list_migrating_vms_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_migrating_vm( - transport: str = "grpc", request_type=vmmigration.GetMigratingVmRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.GetMigratingVmRequest, dict,]) +def test_get_migrating_vm(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4733,10 +4686,6 @@ def test_get_migrating_vm( assert response.group == "group_value" -def test_get_migrating_vm_from_dict(): - test_get_migrating_vm(request_type=dict) - - def test_get_migrating_vm_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4918,9 +4867,8 @@ async def test_get_migrating_vm_flattened_error_async(): ) -def test_update_migrating_vm( - transport: str = "grpc", request_type=vmmigration.UpdateMigratingVmRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.UpdateMigratingVmRequest, dict,]) +def test_update_migrating_vm(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4946,10 +4894,6 @@ def test_update_migrating_vm( assert isinstance(response, future.Future) -def test_update_migrating_vm_from_dict(): - test_update_migrating_vm(request_type=dict) - - def test_update_migrating_vm_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5176,9 +5120,8 @@ async def test_update_migrating_vm_flattened_error_async(): ) -def test_delete_migrating_vm( - transport: str = "grpc", request_type=vmmigration.DeleteMigratingVmRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.DeleteMigratingVmRequest, dict,]) +def test_delete_migrating_vm(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5204,10 +5147,6 @@ def test_delete_migrating_vm( assert isinstance(response, future.Future) -def test_delete_migrating_vm_from_dict(): - test_delete_migrating_vm(request_type=dict) - - def test_delete_migrating_vm_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5388,9 +5327,8 @@ async def test_delete_migrating_vm_flattened_error_async(): ) -def test_start_migration( - transport: str = "grpc", request_type=vmmigration.StartMigrationRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.StartMigrationRequest, dict,]) +def test_start_migration(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5414,10 +5352,6 @@ def test_start_migration( assert isinstance(response, future.Future) -def test_start_migration_from_dict(): - test_start_migration(request_type=dict) - - def test_start_migration_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5590,9 +5524,8 @@ async def test_start_migration_flattened_error_async(): ) -def test_resume_migration( - transport: str = "grpc", request_type=vmmigration.ResumeMigrationRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ResumeMigrationRequest, dict,]) +def test_resume_migration(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5616,10 +5549,6 @@ def test_resume_migration( assert isinstance(response, future.Future) -def test_resume_migration_from_dict(): - test_resume_migration(request_type=dict) - - def test_resume_migration_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5724,9 +5653,8 @@ async def test_resume_migration_field_headers_async(): ] -def test_pause_migration( - transport: str = "grpc", request_type=vmmigration.PauseMigrationRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.PauseMigrationRequest, dict,]) +def test_pause_migration(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5750,10 +5678,6 @@ def test_pause_migration( assert isinstance(response, future.Future) -def test_pause_migration_from_dict(): - test_pause_migration(request_type=dict) - - def test_pause_migration_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -5858,9 +5782,8 @@ async def test_pause_migration_field_headers_async(): ] -def test_finalize_migration( - transport: str = "grpc", request_type=vmmigration.FinalizeMigrationRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.FinalizeMigrationRequest, dict,]) +def test_finalize_migration(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5886,10 +5809,6 @@ def test_finalize_migration( assert isinstance(response, future.Future) -def test_finalize_migration_from_dict(): - test_finalize_migration(request_type=dict) - - def test_finalize_migration_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6074,9 +5993,8 @@ async def test_finalize_migration_flattened_error_async(): ) -def test_create_clone_job( - transport: str = "grpc", request_type=vmmigration.CreateCloneJobRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CreateCloneJobRequest, dict,]) +def test_create_clone_job(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6100,10 +6018,6 @@ def test_create_clone_job( assert isinstance(response, future.Future) -def test_create_clone_job_from_dict(): - test_create_clone_job(request_type=dict) - - def test_create_clone_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6322,9 +6236,8 @@ async def test_create_clone_job_flattened_error_async(): ) -def test_cancel_clone_job( - transport: str = "grpc", request_type=vmmigration.CancelCloneJobRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CancelCloneJobRequest, dict,]) +def test_cancel_clone_job(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6348,10 +6261,6 @@ def test_cancel_clone_job( assert isinstance(response, future.Future) -def test_cancel_clone_job_from_dict(): - test_cancel_clone_job(request_type=dict) - - def test_cancel_clone_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6520,9 +6429,8 @@ async def test_cancel_clone_job_flattened_error_async(): ) -def test_list_clone_jobs( - transport: str = "grpc", request_type=vmmigration.ListCloneJobsRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ListCloneJobsRequest, dict,]) +def test_list_clone_jobs(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6550,10 +6458,6 @@ def test_list_clone_jobs( assert response.unreachable == ["unreachable_value"] -def test_list_clone_jobs_from_dict(): - test_list_clone_jobs(request_type=dict) - - def test_list_clone_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -6727,8 +6631,10 @@ async def test_list_clone_jobs_flattened_error_async(): ) -def test_list_clone_jobs_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_clone_jobs_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clone_jobs), "__call__") as call: @@ -6765,8 +6671,10 @@ def test_list_clone_jobs_pager(): assert all(isinstance(i, vmmigration.CloneJob) for i in results) -def test_list_clone_jobs_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_clone_jobs_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_clone_jobs), "__call__") as call: @@ -6865,9 +6773,8 @@ async def test_list_clone_jobs_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_clone_job( - transport: str = "grpc", request_type=vmmigration.GetCloneJobRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.GetCloneJobRequest, dict,]) +def test_get_clone_job(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6899,10 +6806,6 @@ def test_get_clone_job( assert response.state == vmmigration.CloneJob.State.PENDING -def test_get_clone_job_from_dict(): - test_get_clone_job(request_type=dict) - - def test_get_clone_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7075,9 +6978,8 @@ async def test_get_clone_job_flattened_error_async(): ) -def test_create_cutover_job( - transport: str = "grpc", request_type=vmmigration.CreateCutoverJobRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CreateCutoverJobRequest, dict,]) +def test_create_cutover_job(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7103,10 +7005,6 @@ def test_create_cutover_job( assert isinstance(response, future.Future) -def test_create_cutover_job_from_dict(): - test_create_cutover_job(request_type=dict) - - def test_create_cutover_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7337,9 +7235,8 @@ async def test_create_cutover_job_flattened_error_async(): ) -def test_cancel_cutover_job( - transport: str = "grpc", request_type=vmmigration.CancelCutoverJobRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CancelCutoverJobRequest, dict,]) +def test_cancel_cutover_job(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7365,10 +7262,6 @@ def test_cancel_cutover_job( assert isinstance(response, future.Future) -def test_cancel_cutover_job_from_dict(): - test_cancel_cutover_job(request_type=dict) - - def test_cancel_cutover_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7549,9 +7442,8 @@ async def test_cancel_cutover_job_flattened_error_async(): ) -def test_list_cutover_jobs( - transport: str = "grpc", request_type=vmmigration.ListCutoverJobsRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ListCutoverJobsRequest, dict,]) +def test_list_cutover_jobs(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7581,10 +7473,6 @@ def test_list_cutover_jobs( assert response.unreachable == ["unreachable_value"] -def test_list_cutover_jobs_from_dict(): - test_list_cutover_jobs(request_type=dict) - - def test_list_cutover_jobs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -7770,8 +7658,10 @@ async def test_list_cutover_jobs_flattened_error_async(): ) -def test_list_cutover_jobs_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_cutover_jobs_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7812,8 +7702,10 @@ def test_list_cutover_jobs_pager(): assert all(isinstance(i, vmmigration.CutoverJob) for i in results) -def test_list_cutover_jobs_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_cutover_jobs_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7924,9 +7816,8 @@ async def test_list_cutover_jobs_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_cutover_job( - transport: str = "grpc", request_type=vmmigration.GetCutoverJobRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.GetCutoverJobRequest, dict,]) +def test_get_cutover_job(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7962,10 +7853,6 @@ def test_get_cutover_job( assert response.state_message == "state_message_value" -def test_get_cutover_job_from_dict(): - test_get_cutover_job(request_type=dict) - - def test_get_cutover_job_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -8143,9 +8030,8 @@ async def test_get_cutover_job_flattened_error_async(): ) -def test_list_groups( - transport: str = "grpc", request_type=vmmigration.ListGroupsRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ListGroupsRequest, dict,]) +def test_list_groups(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8173,10 +8059,6 @@ def test_list_groups( assert response.unreachable == ["unreachable_value"] -def test_list_groups_from_dict(): - test_list_groups(request_type=dict) - - def test_list_groups_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -8350,8 +8232,10 @@ async def test_list_groups_flattened_error_async(): ) -def test_list_groups_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_groups_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_groups), "__call__") as call: @@ -8384,8 +8268,10 @@ def test_list_groups_pager(): assert all(isinstance(i, vmmigration.Group) for i in results) -def test_list_groups_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_groups_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_groups), "__call__") as call: @@ -8472,7 +8358,8 @@ async def test_list_groups_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_group(transport: str = "grpc", request_type=vmmigration.GetGroupRequest): +@pytest.mark.parametrize("request_type", [vmmigration.GetGroupRequest, dict,]) +def test_get_group(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8503,10 +8390,6 @@ def test_get_group(transport: str = "grpc", request_type=vmmigration.GetGroupReq assert response.display_name == "display_name_value" -def test_get_group_from_dict(): - test_get_group(request_type=dict) - - def test_get_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -8678,9 +8561,8 @@ async def test_get_group_flattened_error_async(): ) -def test_create_group( - transport: str = "grpc", request_type=vmmigration.CreateGroupRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.CreateGroupRequest, dict,]) +def test_create_group(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8704,10 +8586,6 @@ def test_create_group( assert isinstance(response, future.Future) -def test_create_group_from_dict(): - test_create_group(request_type=dict) - - def test_create_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -8902,9 +8780,8 @@ async def test_create_group_flattened_error_async(): ) -def test_update_group( - transport: str = "grpc", request_type=vmmigration.UpdateGroupRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.UpdateGroupRequest, dict,]) +def test_update_group(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8928,10 +8805,6 @@ def test_update_group( assert isinstance(response, future.Future) -def test_update_group_from_dict(): - test_update_group(request_type=dict) - - def test_update_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -9116,9 +8989,8 @@ async def test_update_group_flattened_error_async(): ) -def test_delete_group( - transport: str = "grpc", request_type=vmmigration.DeleteGroupRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.DeleteGroupRequest, dict,]) +def test_delete_group(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9142,10 +9014,6 @@ def test_delete_group( assert isinstance(response, future.Future) -def test_delete_group_from_dict(): - test_delete_group(request_type=dict) - - def test_delete_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -9314,9 +9182,8 @@ async def test_delete_group_flattened_error_async(): ) -def test_add_group_migration( - transport: str = "grpc", request_type=vmmigration.AddGroupMigrationRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.AddGroupMigrationRequest, dict,]) +def test_add_group_migration(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9342,10 +9209,6 @@ def test_add_group_migration( assert isinstance(response, future.Future) -def test_add_group_migration_from_dict(): - test_add_group_migration(request_type=dict) - - def test_add_group_migration_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -9526,9 +9389,10 @@ async def test_add_group_migration_flattened_error_async(): ) -def test_remove_group_migration( - transport: str = "grpc", request_type=vmmigration.RemoveGroupMigrationRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.RemoveGroupMigrationRequest, dict,] +) +def test_remove_group_migration(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9554,10 +9418,6 @@ def test_remove_group_migration( assert isinstance(response, future.Future) -def test_remove_group_migration_from_dict(): - test_remove_group_migration(request_type=dict) - - def test_remove_group_migration_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -9739,9 +9599,8 @@ async def test_remove_group_migration_flattened_error_async(): ) -def test_list_target_projects( - transport: str = "grpc", request_type=vmmigration.ListTargetProjectsRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.ListTargetProjectsRequest, dict,]) +def test_list_target_projects(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9771,10 +9630,6 @@ def test_list_target_projects( assert response.unreachable == ["unreachable_value"] -def test_list_target_projects_from_dict(): - test_list_target_projects(request_type=dict) - - def test_list_target_projects_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -9960,8 +9815,10 @@ async def test_list_target_projects_flattened_error_async(): ) -def test_list_target_projects_pager(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_target_projects_pager(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10005,8 +9862,10 @@ def test_list_target_projects_pager(): assert all(isinstance(i, vmmigration.TargetProject) for i in results) -def test_list_target_projects_pages(): - client = VmMigrationClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_target_projects_pages(transport_name: str = "grpc"): + client = VmMigrationClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10126,9 +9985,8 @@ async def test_list_target_projects_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_target_project( - transport: str = "grpc", request_type=vmmigration.GetTargetProjectRequest -): +@pytest.mark.parametrize("request_type", [vmmigration.GetTargetProjectRequest, dict,]) +def test_get_target_project(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10159,10 +10017,6 @@ def test_get_target_project( assert response.description == "description_value" -def test_get_target_project_from_dict(): - test_get_target_project(request_type=dict) - - def test_get_target_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -10350,9 +10204,10 @@ async def test_get_target_project_flattened_error_async(): ) -def test_create_target_project( - transport: str = "grpc", request_type=vmmigration.CreateTargetProjectRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.CreateTargetProjectRequest, dict,] +) +def test_create_target_project(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10378,10 +10233,6 @@ def test_create_target_project( assert isinstance(response, future.Future) -def test_create_target_project_from_dict(): - test_create_target_project(request_type=dict) - - def test_create_target_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -10588,9 +10439,10 @@ async def test_create_target_project_flattened_error_async(): ) -def test_update_target_project( - transport: str = "grpc", request_type=vmmigration.UpdateTargetProjectRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.UpdateTargetProjectRequest, dict,] +) +def test_update_target_project(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10616,10 +10468,6 @@ def test_update_target_project( assert isinstance(response, future.Future) -def test_update_target_project_from_dict(): - test_update_target_project(request_type=dict) - - def test_update_target_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -10822,9 +10670,10 @@ async def test_update_target_project_flattened_error_async(): ) -def test_delete_target_project( - transport: str = "grpc", request_type=vmmigration.DeleteTargetProjectRequest -): +@pytest.mark.parametrize( + "request_type", [vmmigration.DeleteTargetProjectRequest, dict,] +) +def test_delete_target_project(request_type, transport: str = "grpc"): client = VmMigrationClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -10850,10 +10699,6 @@ def test_delete_target_project( assert isinstance(response, future.Future) -def test_delete_target_project_from_dict(): - test_delete_target_project(request_type=dict) - - def test_delete_target_project_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -11810,7 +11655,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object(