Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.16.1 (#493)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.16.1

PiperOrigin-RevId: 618243632

Source-Link: googleapis/googleapis@078a38b

Source-Link: googleapis/googleapis-gen@7af768c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2FmNzY4YzNmOGNlNTg5OTQ0ODIzNTBmNzQwMTE3MzMyOTk1MGEzMSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert changes to testing/constraints-3.8.txt

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Mar 26, 2024
1 parent e359d88 commit d5f7e80
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 12 deletions.
1 change: 1 addition & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"google/cloud/errorreporting/",
"setup.py",
"testing/constraints-3.7.txt",
"testing/constraints-3.8.txt",
],
)
s.remove_staging_dirs()
Expand Down
108 changes: 104 additions & 4 deletions tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,8 @@ def test_get_group(request_type, transport: str = "grpc"):
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.GetGroupRequest()
request = error_group_service.GetGroupRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, common.ErrorGroup)
Expand All @@ -1216,6 +1217,56 @@ def test_get_group_empty_call():
assert args[0] == error_group_service.GetGroupRequest()


def test_get_group_non_empty_request_with_auto_populated_field():
# This test is a coverage failsafe to make sure that UUID4 fields are
# automatically populated, according to AIP-4235, with non-empty requests.
client = ErrorGroupServiceClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc",
)

# Populate all string fields in the request which are not UUID4
# since we want to check that UUID4 are populated automatically
# if they meet the requirements of AIP 4235.
request = error_group_service.GetGroupRequest(
group_name="group_name_value",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_group), "__call__") as call:
client.get_group(request=request)
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.GetGroupRequest(
group_name="group_name_value",
)


@pytest.mark.asyncio
async def test_get_group_empty_call_async():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ErrorGroupServiceAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc_asyncio",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_group), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
common.ErrorGroup(
name="name_value",
group_id="group_id_value",
resolution_status=common.ResolutionStatus.OPEN,
)
)
response = await client.get_group()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.GetGroupRequest()


@pytest.mark.asyncio
async def test_get_group_async(
transport: str = "grpc_asyncio", request_type=error_group_service.GetGroupRequest
Expand Down Expand Up @@ -1244,7 +1295,8 @@ async def test_get_group_async(
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.GetGroupRequest()
request = error_group_service.GetGroupRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, common.ErrorGroup)
Expand Down Expand Up @@ -1427,7 +1479,8 @@ def test_update_group(request_type, transport: str = "grpc"):
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.UpdateGroupRequest()
request = error_group_service.UpdateGroupRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, common.ErrorGroup)
Expand All @@ -1452,6 +1505,52 @@ def test_update_group_empty_call():
assert args[0] == error_group_service.UpdateGroupRequest()


def test_update_group_non_empty_request_with_auto_populated_field():
# This test is a coverage failsafe to make sure that UUID4 fields are
# automatically populated, according to AIP-4235, with non-empty requests.
client = ErrorGroupServiceClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc",
)

# Populate all string fields in the request which are not UUID4
# since we want to check that UUID4 are populated automatically
# if they meet the requirements of AIP 4235.
request = error_group_service.UpdateGroupRequest()

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_group), "__call__") as call:
client.update_group(request=request)
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.UpdateGroupRequest()


@pytest.mark.asyncio
async def test_update_group_empty_call_async():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ErrorGroupServiceAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc_asyncio",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_group), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
common.ErrorGroup(
name="name_value",
group_id="group_id_value",
resolution_status=common.ResolutionStatus.OPEN,
)
)
response = await client.update_group()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.UpdateGroupRequest()


@pytest.mark.asyncio
async def test_update_group_async(
transport: str = "grpc_asyncio", request_type=error_group_service.UpdateGroupRequest
Expand Down Expand Up @@ -1480,7 +1579,8 @@ async def test_update_group_async(
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == error_group_service.UpdateGroupRequest()
request = error_group_service.UpdateGroupRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, common.ErrorGroup)
Expand Down
166 changes: 160 additions & 6 deletions tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,8 @@ def test_list_group_stats(request_type, transport: str = "grpc"):
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListGroupStatsRequest()
request = error_stats_service.ListGroupStatsRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListGroupStatsPager)
Expand All @@ -1215,6 +1216,56 @@ def test_list_group_stats_empty_call():
assert args[0] == error_stats_service.ListGroupStatsRequest()


def test_list_group_stats_non_empty_request_with_auto_populated_field():
# This test is a coverage failsafe to make sure that UUID4 fields are
# automatically populated, according to AIP-4235, with non-empty requests.
client = ErrorStatsServiceClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc",
)

# Populate all string fields in the request which are not UUID4
# since we want to check that UUID4 are populated automatically
# if they meet the requirements of AIP 4235.
request = error_stats_service.ListGroupStatsRequest(
project_name="project_name_value",
page_token="page_token_value",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_group_stats), "__call__") as call:
client.list_group_stats(request=request)
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListGroupStatsRequest(
project_name="project_name_value",
page_token="page_token_value",
)


@pytest.mark.asyncio
async def test_list_group_stats_empty_call_async():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ErrorStatsServiceAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc_asyncio",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_group_stats), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
error_stats_service.ListGroupStatsResponse(
next_page_token="next_page_token_value",
)
)
response = await client.list_group_stats()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListGroupStatsRequest()


@pytest.mark.asyncio
async def test_list_group_stats_async(
transport: str = "grpc_asyncio",
Expand Down Expand Up @@ -1242,7 +1293,8 @@ async def test_list_group_stats_async(
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListGroupStatsRequest()
request = error_stats_service.ListGroupStatsRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListGroupStatsAsyncPager)
Expand Down Expand Up @@ -1639,7 +1691,8 @@ def test_list_events(request_type, transport: str = "grpc"):
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListEventsRequest()
request = error_stats_service.ListEventsRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListEventsPager)
Expand All @@ -1662,6 +1715,58 @@ def test_list_events_empty_call():
assert args[0] == error_stats_service.ListEventsRequest()


def test_list_events_non_empty_request_with_auto_populated_field():
# This test is a coverage failsafe to make sure that UUID4 fields are
# automatically populated, according to AIP-4235, with non-empty requests.
client = ErrorStatsServiceClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc",
)

# Populate all string fields in the request which are not UUID4
# since we want to check that UUID4 are populated automatically
# if they meet the requirements of AIP 4235.
request = error_stats_service.ListEventsRequest(
project_name="project_name_value",
group_id="group_id_value",
page_token="page_token_value",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_events), "__call__") as call:
client.list_events(request=request)
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListEventsRequest(
project_name="project_name_value",
group_id="group_id_value",
page_token="page_token_value",
)


@pytest.mark.asyncio
async def test_list_events_empty_call_async():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ErrorStatsServiceAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc_asyncio",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_events), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
error_stats_service.ListEventsResponse(
next_page_token="next_page_token_value",
)
)
response = await client.list_events()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListEventsRequest()


@pytest.mark.asyncio
async def test_list_events_async(
transport: str = "grpc_asyncio", request_type=error_stats_service.ListEventsRequest
Expand All @@ -1688,7 +1793,8 @@ async def test_list_events_async(
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.ListEventsRequest()
request = error_stats_service.ListEventsRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, pagers.ListEventsAsyncPager)
Expand Down Expand Up @@ -2069,7 +2175,8 @@ def test_delete_events(request_type, transport: str = "grpc"):
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.DeleteEventsRequest()
request = error_stats_service.DeleteEventsRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, error_stats_service.DeleteEventsResponse)
Expand All @@ -2091,6 +2198,52 @@ def test_delete_events_empty_call():
assert args[0] == error_stats_service.DeleteEventsRequest()


def test_delete_events_non_empty_request_with_auto_populated_field():
# This test is a coverage failsafe to make sure that UUID4 fields are
# automatically populated, according to AIP-4235, with non-empty requests.
client = ErrorStatsServiceClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc",
)

# Populate all string fields in the request which are not UUID4
# since we want to check that UUID4 are populated automatically
# if they meet the requirements of AIP 4235.
request = error_stats_service.DeleteEventsRequest(
project_name="project_name_value",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_events), "__call__") as call:
client.delete_events(request=request)
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.DeleteEventsRequest(
project_name="project_name_value",
)


@pytest.mark.asyncio
async def test_delete_events_empty_call_async():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ErrorStatsServiceAsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
transport="grpc_asyncio",
)

# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_events), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
error_stats_service.DeleteEventsResponse()
)
response = await client.delete_events()
call.assert_called()
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.DeleteEventsRequest()


@pytest.mark.asyncio
async def test_delete_events_async(
transport: str = "grpc_asyncio",
Expand All @@ -2116,7 +2269,8 @@ async def test_delete_events_async(
# Establish that the underlying gRPC stub method was called.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]
assert args[0] == error_stats_service.DeleteEventsRequest()
request = error_stats_service.DeleteEventsRequest()
assert args[0] == request

# Establish that the response is the type that we expect.
assert isinstance(response, error_stats_service.DeleteEventsResponse)
Expand Down
Loading

0 comments on commit d5f7e80

Please sign in to comment.