Skip to content

Commit f81af2c

Browse files
chore: use gapic-generator-python 0.58.4 (#55)
* chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: googleapis/googleapis@73da669 Source-Link: googleapis/googleapis-gen@46df624 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent b0337d9 commit f81af2c

File tree

8 files changed

+92
-146
lines changed

8 files changed

+92
-146
lines changed

packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/environments/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(
103103
credentials, _ = google.auth.load_credentials_from_file(
104104
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
105105
)
106-
107106
elif credentials is None:
108107
credentials, _ = google.auth.default(
109108
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1/services/image_versions/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
credentials, _ = google.auth.load_credentials_from_file(
102102
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
103103
)
104-
105104
elif credentials is None:
106105
credentials, _ = google.auth.default(
107106
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/environments/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(
103103
credentials, _ = google.auth.load_credentials_from_file(
104104
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
105105
)
106-
107106
elif credentials is None:
108107
credentials, _ = google.auth.default(
109108
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-orchestration-airflow/google/cloud/orchestration/airflow/service_v1beta1/services/image_versions/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
credentials, _ = google.auth.load_credentials_from_file(
102102
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
103103
)
104-
105104
elif credentials is None:
106105
credentials, _ = google.auth.default(
107106
**scopes_kwargs, quota_project_id=quota_project_id

packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_environments.py

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,20 @@ def test_environments_client_client_options(
250250
# unsupported value.
251251
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
252252
with pytest.raises(MutualTLSChannelError):
253-
client = client_class()
253+
client = client_class(transport=transport_name)
254254

255255
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
256256
with mock.patch.dict(
257257
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
258258
):
259259
with pytest.raises(ValueError):
260-
client = client_class()
260+
client = client_class(transport=transport_name)
261261

262262
# Check the case quota_project_id is provided
263263
options = client_options.ClientOptions(quota_project_id="octopus")
264264
with mock.patch.object(transport_class, "__init__") as patched:
265265
patched.return_value = None
266-
client = client_class(transport=transport_name, client_options=options)
266+
client = client_class(client_options=options, transport=transport_name)
267267
patched.assert_called_once_with(
268268
credentials=None,
269269
credentials_file=None,
@@ -320,7 +320,7 @@ def test_environments_client_mtls_env_auto(
320320
)
321321
with mock.patch.object(transport_class, "__init__") as patched:
322322
patched.return_value = None
323-
client = client_class(transport=transport_name, client_options=options)
323+
client = client_class(client_options=options, transport=transport_name)
324324

325325
if use_client_cert_env == "false":
326326
expected_client_cert_source = None
@@ -415,7 +415,7 @@ def test_environments_client_client_options_scopes(
415415
options = client_options.ClientOptions(scopes=["1", "2"],)
416416
with mock.patch.object(transport_class, "__init__") as patched:
417417
patched.return_value = None
418-
client = client_class(transport=transport_name, client_options=options)
418+
client = client_class(client_options=options, transport=transport_name)
419419
patched.assert_called_once_with(
420420
credentials=None,
421421
credentials_file=None,
@@ -446,7 +446,7 @@ def test_environments_client_client_options_credentials_file(
446446
options = client_options.ClientOptions(credentials_file="credentials.json")
447447
with mock.patch.object(transport_class, "__init__") as patched:
448448
patched.return_value = None
449-
client = client_class(transport=transport_name, client_options=options)
449+
client = client_class(client_options=options, transport=transport_name)
450450
patched.assert_called_once_with(
451451
credentials=None,
452452
credentials_file="credentials.json",
@@ -477,9 +477,8 @@ def test_environments_client_client_options_from_dict():
477477
)
478478

479479

480-
def test_create_environment(
481-
transport: str = "grpc", request_type=environments.CreateEnvironmentRequest
482-
):
480+
@pytest.mark.parametrize("request_type", [environments.CreateEnvironmentRequest, dict,])
481+
def test_create_environment(request_type, transport: str = "grpc"):
483482
client = EnvironmentsClient(
484483
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
485484
)
@@ -505,10 +504,6 @@ def test_create_environment(
505504
assert isinstance(response, future.Future)
506505

507506

508-
def test_create_environment_from_dict():
509-
test_create_environment(request_type=dict)
510-
511-
512507
def test_create_environment_empty_call():
513508
# This test is a coverage failsafe to make sure that totally empty calls,
514509
# i.e. request == None and no flattened fields passed, work.
@@ -705,9 +700,8 @@ async def test_create_environment_flattened_error_async():
705700
)
706701

707702

708-
def test_get_environment(
709-
transport: str = "grpc", request_type=environments.GetEnvironmentRequest
710-
):
703+
@pytest.mark.parametrize("request_type", [environments.GetEnvironmentRequest, dict,])
704+
def test_get_environment(request_type, transport: str = "grpc"):
711705
client = EnvironmentsClient(
712706
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
713707
)
@@ -738,10 +732,6 @@ def test_get_environment(
738732
assert response.state == environments.Environment.State.CREATING
739733

740734

741-
def test_get_environment_from_dict():
742-
test_get_environment(request_type=dict)
743-
744-
745735
def test_get_environment_empty_call():
746736
# This test is a coverage failsafe to make sure that totally empty calls,
747737
# i.e. request == None and no flattened fields passed, work.
@@ -917,9 +907,8 @@ async def test_get_environment_flattened_error_async():
917907
)
918908

919909

920-
def test_list_environments(
921-
transport: str = "grpc", request_type=environments.ListEnvironmentsRequest
922-
):
910+
@pytest.mark.parametrize("request_type", [environments.ListEnvironmentsRequest, dict,])
911+
def test_list_environments(request_type, transport: str = "grpc"):
923912
client = EnvironmentsClient(
924913
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
925914
)
@@ -948,10 +937,6 @@ def test_list_environments(
948937
assert response.next_page_token == "next_page_token_value"
949938

950939

951-
def test_list_environments_from_dict():
952-
test_list_environments(request_type=dict)
953-
954-
955940
def test_list_environments_empty_call():
956941
# This test is a coverage failsafe to make sure that totally empty calls,
957942
# i.e. request == None and no flattened fields passed, work.
@@ -1135,8 +1120,10 @@ async def test_list_environments_flattened_error_async():
11351120
)
11361121

11371122

1138-
def test_list_environments_pager():
1139-
client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials,)
1123+
def test_list_environments_pager(transport_name: str = "grpc"):
1124+
client = EnvironmentsClient(
1125+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
1126+
)
11401127

11411128
# Mock the actual call within the gRPC stub, and fake the request.
11421129
with mock.patch.object(
@@ -1177,8 +1164,10 @@ def test_list_environments_pager():
11771164
assert all(isinstance(i, environments.Environment) for i in results)
11781165

11791166

1180-
def test_list_environments_pages():
1181-
client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials,)
1167+
def test_list_environments_pages(transport_name: str = "grpc"):
1168+
client = EnvironmentsClient(
1169+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
1170+
)
11821171

11831172
# Mock the actual call within the gRPC stub, and fake the request.
11841173
with mock.patch.object(
@@ -1289,9 +1278,8 @@ async def test_list_environments_async_pages():
12891278
assert page_.raw_page.next_page_token == token
12901279

12911280

1292-
def test_update_environment(
1293-
transport: str = "grpc", request_type=environments.UpdateEnvironmentRequest
1294-
):
1281+
@pytest.mark.parametrize("request_type", [environments.UpdateEnvironmentRequest, dict,])
1282+
def test_update_environment(request_type, transport: str = "grpc"):
12951283
client = EnvironmentsClient(
12961284
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
12971285
)
@@ -1317,10 +1305,6 @@ def test_update_environment(
13171305
assert isinstance(response, future.Future)
13181306

13191307

1320-
def test_update_environment_from_dict():
1321-
test_update_environment(request_type=dict)
1322-
1323-
13241308
def test_update_environment_empty_call():
13251309
# This test is a coverage failsafe to make sure that totally empty calls,
13261310
# i.e. request == None and no flattened fields passed, work.
@@ -1527,9 +1511,8 @@ async def test_update_environment_flattened_error_async():
15271511
)
15281512

15291513

1530-
def test_delete_environment(
1531-
transport: str = "grpc", request_type=environments.DeleteEnvironmentRequest
1532-
):
1514+
@pytest.mark.parametrize("request_type", [environments.DeleteEnvironmentRequest, dict,])
1515+
def test_delete_environment(request_type, transport: str = "grpc"):
15331516
client = EnvironmentsClient(
15341517
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
15351518
)
@@ -1555,10 +1538,6 @@ def test_delete_environment(
15551538
assert isinstance(response, future.Future)
15561539

15571540

1558-
def test_delete_environment_from_dict():
1559-
test_delete_environment(request_type=dict)
1560-
1561-
15621541
def test_delete_environment_empty_call():
15631542
# This test is a coverage failsafe to make sure that totally empty calls,
15641543
# i.e. request == None and no flattened fields passed, work.
@@ -2277,7 +2256,7 @@ def test_parse_common_location_path():
22772256
assert expected == actual
22782257

22792258

2280-
def test_client_withDEFAULT_CLIENT_INFO():
2259+
def test_client_with_default_client_info():
22812260
client_info = gapic_v1.client_info.ClientInfo()
22822261

22832262
with mock.patch.object(

packages/google-cloud-orchestration-airflow/tests/unit/gapic/service_v1/test_image_versions.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,20 @@ def test_image_versions_client_client_options(
252252
# unsupported value.
253253
with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}):
254254
with pytest.raises(MutualTLSChannelError):
255-
client = client_class()
255+
client = client_class(transport=transport_name)
256256

257257
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
258258
with mock.patch.dict(
259259
os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"}
260260
):
261261
with pytest.raises(ValueError):
262-
client = client_class()
262+
client = client_class(transport=transport_name)
263263

264264
# Check the case quota_project_id is provided
265265
options = client_options.ClientOptions(quota_project_id="octopus")
266266
with mock.patch.object(transport_class, "__init__") as patched:
267267
patched.return_value = None
268-
client = client_class(transport=transport_name, client_options=options)
268+
client = client_class(client_options=options, transport=transport_name)
269269
patched.assert_called_once_with(
270270
credentials=None,
271271
credentials_file=None,
@@ -324,7 +324,7 @@ def test_image_versions_client_mtls_env_auto(
324324
)
325325
with mock.patch.object(transport_class, "__init__") as patched:
326326
patched.return_value = None
327-
client = client_class(transport=transport_name, client_options=options)
327+
client = client_class(client_options=options, transport=transport_name)
328328

329329
if use_client_cert_env == "false":
330330
expected_client_cert_source = None
@@ -419,7 +419,7 @@ def test_image_versions_client_client_options_scopes(
419419
options = client_options.ClientOptions(scopes=["1", "2"],)
420420
with mock.patch.object(transport_class, "__init__") as patched:
421421
patched.return_value = None
422-
client = client_class(transport=transport_name, client_options=options)
422+
client = client_class(client_options=options, transport=transport_name)
423423
patched.assert_called_once_with(
424424
credentials=None,
425425
credentials_file=None,
@@ -450,7 +450,7 @@ def test_image_versions_client_client_options_credentials_file(
450450
options = client_options.ClientOptions(credentials_file="credentials.json")
451451
with mock.patch.object(transport_class, "__init__") as patched:
452452
patched.return_value = None
453-
client = client_class(transport=transport_name, client_options=options)
453+
client = client_class(client_options=options, transport=transport_name)
454454
patched.assert_called_once_with(
455455
credentials=None,
456456
credentials_file="credentials.json",
@@ -483,9 +483,10 @@ def test_image_versions_client_client_options_from_dict():
483483
)
484484

485485

486-
def test_list_image_versions(
487-
transport: str = "grpc", request_type=image_versions.ListImageVersionsRequest
488-
):
486+
@pytest.mark.parametrize(
487+
"request_type", [image_versions.ListImageVersionsRequest, dict,]
488+
)
489+
def test_list_image_versions(request_type, transport: str = "grpc"):
489490
client = ImageVersionsClient(
490491
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
491492
)
@@ -514,10 +515,6 @@ def test_list_image_versions(
514515
assert response.next_page_token == "next_page_token_value"
515516

516517

517-
def test_list_image_versions_from_dict():
518-
test_list_image_versions(request_type=dict)
519-
520-
521518
def test_list_image_versions_empty_call():
522519
# This test is a coverage failsafe to make sure that totally empty calls,
523520
# i.e. request == None and no flattened fields passed, work.
@@ -708,8 +705,10 @@ async def test_list_image_versions_flattened_error_async():
708705
)
709706

710707

711-
def test_list_image_versions_pager():
712-
client = ImageVersionsClient(credentials=ga_credentials.AnonymousCredentials,)
708+
def test_list_image_versions_pager(transport_name: str = "grpc"):
709+
client = ImageVersionsClient(
710+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
711+
)
713712

714713
# Mock the actual call within the gRPC stub, and fake the request.
715714
with mock.patch.object(
@@ -753,8 +752,10 @@ def test_list_image_versions_pager():
753752
assert all(isinstance(i, image_versions.ImageVersion) for i in results)
754753

755754

756-
def test_list_image_versions_pages():
757-
client = ImageVersionsClient(credentials=ga_credentials.AnonymousCredentials,)
755+
def test_list_image_versions_pages(transport_name: str = "grpc"):
756+
client = ImageVersionsClient(
757+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
758+
)
758759

759760
# Mock the actual call within the gRPC stub, and fake the request.
760761
with mock.patch.object(
@@ -1360,7 +1361,7 @@ def test_parse_common_location_path():
13601361
assert expected == actual
13611362

13621363

1363-
def test_client_withDEFAULT_CLIENT_INFO():
1364+
def test_client_with_default_client_info():
13641365
client_info = gapic_v1.client_info.ClientInfo()
13651366

13661367
with mock.patch.object(

0 commit comments

Comments
 (0)