Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 089fc75

Browse files
chore: use gapic-generator-python 0.58.4 (#164)
* 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: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 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 2aae8f6 commit 089fc75

4 files changed

Lines changed: 50 additions & 94 deletions

File tree

google/cloud/billing/budgets_v1/services/budget_service/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def __init__(
106106
credentials, _ = google.auth.load_credentials_from_file(
107107
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
108108
)
109-
110109
elif credentials is None:
111110
credentials, _ = google.auth.default(
112111
**scopes_kwargs, quota_project_id=quota_project_id

google/cloud/billing/budgets_v1beta1/services/budget_service/transports/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def __init__(
106106
credentials, _ = google.auth.load_credentials_from_file(
107107
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
108108
)
109-
110109
elif credentials is None:
111110
credentials, _ = google.auth.default(
112111
**scopes_kwargs, quota_project_id=quota_project_id

tests/unit/gapic/budgets_v1/test_budget_service.py

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

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

265265
# Check the case quota_project_id is provided
266266
options = client_options.ClientOptions(quota_project_id="octopus")
267267
with mock.patch.object(transport_class, "__init__") as patched:
268268
patched.return_value = None
269-
client = client_class(transport=transport_name, client_options=options)
269+
client = client_class(client_options=options, transport=transport_name)
270270
patched.assert_called_once_with(
271271
credentials=None,
272272
credentials_file=None,
@@ -325,7 +325,7 @@ def test_budget_service_client_mtls_env_auto(
325325
)
326326
with mock.patch.object(transport_class, "__init__") as patched:
327327
patched.return_value = None
328-
client = client_class(transport=transport_name, client_options=options)
328+
client = client_class(client_options=options, transport=transport_name)
329329

330330
if use_client_cert_env == "false":
331331
expected_client_cert_source = None
@@ -420,7 +420,7 @@ def test_budget_service_client_client_options_scopes(
420420
options = client_options.ClientOptions(scopes=["1", "2"],)
421421
with mock.patch.object(transport_class, "__init__") as patched:
422422
patched.return_value = None
423-
client = client_class(transport=transport_name, client_options=options)
423+
client = client_class(client_options=options, transport=transport_name)
424424
patched.assert_called_once_with(
425425
credentials=None,
426426
credentials_file=None,
@@ -451,7 +451,7 @@ def test_budget_service_client_client_options_credentials_file(
451451
options = client_options.ClientOptions(credentials_file="credentials.json")
452452
with mock.patch.object(transport_class, "__init__") as patched:
453453
patched.return_value = None
454-
client = client_class(transport=transport_name, client_options=options)
454+
client = client_class(client_options=options, transport=transport_name)
455455
patched.assert_called_once_with(
456456
credentials=None,
457457
credentials_file="credentials.json",
@@ -484,9 +484,8 @@ def test_budget_service_client_client_options_from_dict():
484484
)
485485

486486

487-
def test_create_budget(
488-
transport: str = "grpc", request_type=budget_service.CreateBudgetRequest
489-
):
487+
@pytest.mark.parametrize("request_type", [budget_service.CreateBudgetRequest, dict,])
488+
def test_create_budget(request_type, transport: str = "grpc"):
490489
client = BudgetServiceClient(
491490
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
492491
)
@@ -515,10 +514,6 @@ def test_create_budget(
515514
assert response.etag == "etag_value"
516515

517516

518-
def test_create_budget_from_dict():
519-
test_create_budget(request_type=dict)
520-
521-
522517
def test_create_budget_empty_call():
523518
# This test is a coverage failsafe to make sure that totally empty calls,
524519
# i.e. request == None and no flattened fields passed, work.
@@ -708,9 +703,8 @@ async def test_create_budget_flattened_error_async():
708703
)
709704

710705

711-
def test_update_budget(
712-
transport: str = "grpc", request_type=budget_service.UpdateBudgetRequest
713-
):
706+
@pytest.mark.parametrize("request_type", [budget_service.UpdateBudgetRequest, dict,])
707+
def test_update_budget(request_type, transport: str = "grpc"):
714708
client = BudgetServiceClient(
715709
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
716710
)
@@ -739,10 +733,6 @@ def test_update_budget(
739733
assert response.etag == "etag_value"
740734

741735

742-
def test_update_budget_from_dict():
743-
test_update_budget(request_type=dict)
744-
745-
746736
def test_update_budget_empty_call():
747737
# This test is a coverage failsafe to make sure that totally empty calls,
748738
# i.e. request == None and no flattened fields passed, work.
@@ -934,9 +924,8 @@ async def test_update_budget_flattened_error_async():
934924
)
935925

936926

937-
def test_get_budget(
938-
transport: str = "grpc", request_type=budget_service.GetBudgetRequest
939-
):
927+
@pytest.mark.parametrize("request_type", [budget_service.GetBudgetRequest, dict,])
928+
def test_get_budget(request_type, transport: str = "grpc"):
940929
client = BudgetServiceClient(
941930
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
942931
)
@@ -965,10 +954,6 @@ def test_get_budget(
965954
assert response.etag == "etag_value"
966955

967956

968-
def test_get_budget_from_dict():
969-
test_get_budget(request_type=dict)
970-
971-
972957
def test_get_budget_empty_call():
973958
# This test is a coverage failsafe to make sure that totally empty calls,
974959
# i.e. request == None and no flattened fields passed, work.
@@ -1144,9 +1129,8 @@ async def test_get_budget_flattened_error_async():
11441129
)
11451130

11461131

1147-
def test_list_budgets(
1148-
transport: str = "grpc", request_type=budget_service.ListBudgetsRequest
1149-
):
1132+
@pytest.mark.parametrize("request_type", [budget_service.ListBudgetsRequest, dict,])
1133+
def test_list_budgets(request_type, transport: str = "grpc"):
11501134
client = BudgetServiceClient(
11511135
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
11521136
)
@@ -1173,10 +1157,6 @@ def test_list_budgets(
11731157
assert response.next_page_token == "next_page_token_value"
11741158

11751159

1176-
def test_list_budgets_from_dict():
1177-
test_list_budgets(request_type=dict)
1178-
1179-
11801160
def test_list_budgets_empty_call():
11811161
# This test is a coverage failsafe to make sure that totally empty calls,
11821162
# i.e. request == None and no flattened fields passed, work.
@@ -1352,8 +1332,10 @@ async def test_list_budgets_flattened_error_async():
13521332
)
13531333

13541334

1355-
def test_list_budgets_pager():
1356-
client = BudgetServiceClient(credentials=ga_credentials.AnonymousCredentials,)
1335+
def test_list_budgets_pager(transport_name: str = "grpc"):
1336+
client = BudgetServiceClient(
1337+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
1338+
)
13571339

13581340
# Mock the actual call within the gRPC stub, and fake the request.
13591341
with mock.patch.object(type(client.transport.list_budgets), "__call__") as call:
@@ -1390,8 +1372,10 @@ def test_list_budgets_pager():
13901372
assert all(isinstance(i, budget_model.Budget) for i in results)
13911373

13921374

1393-
def test_list_budgets_pages():
1394-
client = BudgetServiceClient(credentials=ga_credentials.AnonymousCredentials,)
1375+
def test_list_budgets_pages(transport_name: str = "grpc"):
1376+
client = BudgetServiceClient(
1377+
credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
1378+
)
13951379

13961380
# Mock the actual call within the gRPC stub, and fake the request.
13971381
with mock.patch.object(type(client.transport.list_budgets), "__call__") as call:
@@ -1490,9 +1474,8 @@ async def test_list_budgets_async_pages():
14901474
assert page_.raw_page.next_page_token == token
14911475

14921476

1493-
def test_delete_budget(
1494-
transport: str = "grpc", request_type=budget_service.DeleteBudgetRequest
1495-
):
1477+
@pytest.mark.parametrize("request_type", [budget_service.DeleteBudgetRequest, dict,])
1478+
def test_delete_budget(request_type, transport: str = "grpc"):
14961479
client = BudgetServiceClient(
14971480
credentials=ga_credentials.AnonymousCredentials(), transport=transport,
14981481
)
@@ -1516,10 +1499,6 @@ def test_delete_budget(
15161499
assert response is None
15171500

15181501

1519-
def test_delete_budget_from_dict():
1520-
test_delete_budget(request_type=dict)
1521-
1522-
15231502
def test_delete_budget_empty_call():
15241503
# This test is a coverage failsafe to make sure that totally empty calls,
15251504
# i.e. request == None and no flattened fields passed, work.
@@ -2214,7 +2193,7 @@ def test_parse_common_location_path():
22142193
assert expected == actual
22152194

22162195

2217-
def test_client_withDEFAULT_CLIENT_INFO():
2196+
def test_client_with_default_client_info():
22182197
client_info = gapic_v1.client_info.ClientInfo()
22192198

22202199
with mock.patch.object(

0 commit comments

Comments
 (0)