Skip to content

Commit d5f7e80

Browse files
chore: Update gapic-generator-python to v1.16.1 (#493)
* 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]>
1 parent e359d88 commit d5f7e80

File tree

4 files changed

+319
-12
lines changed

4 files changed

+319
-12
lines changed

owlbot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"google/cloud/errorreporting/",
4444
"setup.py",
4545
"testing/constraints-3.7.txt",
46+
"testing/constraints-3.8.txt",
4647
],
4748
)
4849
s.remove_staging_dirs()

tests/unit/gapic/errorreporting_v1beta1/test_error_group_service.py

Lines changed: 104 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,8 @@ def test_get_group(request_type, transport: str = "grpc"):
11911191
# Establish that the underlying gRPC stub method was called.
11921192
assert len(call.mock_calls) == 1
11931193
_, args, _ = call.mock_calls[0]
1194-
assert args[0] == error_group_service.GetGroupRequest()
1194+
request = error_group_service.GetGroupRequest()
1195+
assert args[0] == request
11951196

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

12181219

1220+
def test_get_group_non_empty_request_with_auto_populated_field():
1221+
# This test is a coverage failsafe to make sure that UUID4 fields are
1222+
# automatically populated, according to AIP-4235, with non-empty requests.
1223+
client = ErrorGroupServiceClient(
1224+
credentials=ga_credentials.AnonymousCredentials(),
1225+
transport="grpc",
1226+
)
1227+
1228+
# Populate all string fields in the request which are not UUID4
1229+
# since we want to check that UUID4 are populated automatically
1230+
# if they meet the requirements of AIP 4235.
1231+
request = error_group_service.GetGroupRequest(
1232+
group_name="group_name_value",
1233+
)
1234+
1235+
# Mock the actual call within the gRPC stub, and fake the request.
1236+
with mock.patch.object(type(client.transport.get_group), "__call__") as call:
1237+
client.get_group(request=request)
1238+
call.assert_called()
1239+
_, args, _ = call.mock_calls[0]
1240+
assert args[0] == error_group_service.GetGroupRequest(
1241+
group_name="group_name_value",
1242+
)
1243+
1244+
1245+
@pytest.mark.asyncio
1246+
async def test_get_group_empty_call_async():
1247+
# This test is a coverage failsafe to make sure that totally empty calls,
1248+
# i.e. request == None and no flattened fields passed, work.
1249+
client = ErrorGroupServiceAsyncClient(
1250+
credentials=ga_credentials.AnonymousCredentials(),
1251+
transport="grpc_asyncio",
1252+
)
1253+
1254+
# Mock the actual call within the gRPC stub, and fake the request.
1255+
with mock.patch.object(type(client.transport.get_group), "__call__") as call:
1256+
# Designate an appropriate return value for the call.
1257+
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
1258+
common.ErrorGroup(
1259+
name="name_value",
1260+
group_id="group_id_value",
1261+
resolution_status=common.ResolutionStatus.OPEN,
1262+
)
1263+
)
1264+
response = await client.get_group()
1265+
call.assert_called()
1266+
_, args, _ = call.mock_calls[0]
1267+
assert args[0] == error_group_service.GetGroupRequest()
1268+
1269+
12191270
@pytest.mark.asyncio
12201271
async def test_get_group_async(
12211272
transport: str = "grpc_asyncio", request_type=error_group_service.GetGroupRequest
@@ -1244,7 +1295,8 @@ async def test_get_group_async(
12441295
# Establish that the underlying gRPC stub method was called.
12451296
assert len(call.mock_calls)
12461297
_, args, _ = call.mock_calls[0]
1247-
assert args[0] == error_group_service.GetGroupRequest()
1298+
request = error_group_service.GetGroupRequest()
1299+
assert args[0] == request
12481300

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

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

14541507

1508+
def test_update_group_non_empty_request_with_auto_populated_field():
1509+
# This test is a coverage failsafe to make sure that UUID4 fields are
1510+
# automatically populated, according to AIP-4235, with non-empty requests.
1511+
client = ErrorGroupServiceClient(
1512+
credentials=ga_credentials.AnonymousCredentials(),
1513+
transport="grpc",
1514+
)
1515+
1516+
# Populate all string fields in the request which are not UUID4
1517+
# since we want to check that UUID4 are populated automatically
1518+
# if they meet the requirements of AIP 4235.
1519+
request = error_group_service.UpdateGroupRequest()
1520+
1521+
# Mock the actual call within the gRPC stub, and fake the request.
1522+
with mock.patch.object(type(client.transport.update_group), "__call__") as call:
1523+
client.update_group(request=request)
1524+
call.assert_called()
1525+
_, args, _ = call.mock_calls[0]
1526+
assert args[0] == error_group_service.UpdateGroupRequest()
1527+
1528+
1529+
@pytest.mark.asyncio
1530+
async def test_update_group_empty_call_async():
1531+
# This test is a coverage failsafe to make sure that totally empty calls,
1532+
# i.e. request == None and no flattened fields passed, work.
1533+
client = ErrorGroupServiceAsyncClient(
1534+
credentials=ga_credentials.AnonymousCredentials(),
1535+
transport="grpc_asyncio",
1536+
)
1537+
1538+
# Mock the actual call within the gRPC stub, and fake the request.
1539+
with mock.patch.object(type(client.transport.update_group), "__call__") as call:
1540+
# Designate an appropriate return value for the call.
1541+
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
1542+
common.ErrorGroup(
1543+
name="name_value",
1544+
group_id="group_id_value",
1545+
resolution_status=common.ResolutionStatus.OPEN,
1546+
)
1547+
)
1548+
response = await client.update_group()
1549+
call.assert_called()
1550+
_, args, _ = call.mock_calls[0]
1551+
assert args[0] == error_group_service.UpdateGroupRequest()
1552+
1553+
14551554
@pytest.mark.asyncio
14561555
async def test_update_group_async(
14571556
transport: str = "grpc_asyncio", request_type=error_group_service.UpdateGroupRequest
@@ -1480,7 +1579,8 @@ async def test_update_group_async(
14801579
# Establish that the underlying gRPC stub method was called.
14811580
assert len(call.mock_calls)
14821581
_, args, _ = call.mock_calls[0]
1483-
assert args[0] == error_group_service.UpdateGroupRequest()
1582+
request = error_group_service.UpdateGroupRequest()
1583+
assert args[0] == request
14841584

14851585
# Establish that the response is the type that we expect.
14861586
assert isinstance(response, common.ErrorGroup)

tests/unit/gapic/errorreporting_v1beta1/test_error_stats_service.py

Lines changed: 160 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,8 @@ def test_list_group_stats(request_type, transport: str = "grpc"):
11921192
# Establish that the underlying gRPC stub method was called.
11931193
assert len(call.mock_calls) == 1
11941194
_, args, _ = call.mock_calls[0]
1195-
assert args[0] == error_stats_service.ListGroupStatsRequest()
1195+
request = error_stats_service.ListGroupStatsRequest()
1196+
assert args[0] == request
11961197

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

12171218

1219+
def test_list_group_stats_non_empty_request_with_auto_populated_field():
1220+
# This test is a coverage failsafe to make sure that UUID4 fields are
1221+
# automatically populated, according to AIP-4235, with non-empty requests.
1222+
client = ErrorStatsServiceClient(
1223+
credentials=ga_credentials.AnonymousCredentials(),
1224+
transport="grpc",
1225+
)
1226+
1227+
# Populate all string fields in the request which are not UUID4
1228+
# since we want to check that UUID4 are populated automatically
1229+
# if they meet the requirements of AIP 4235.
1230+
request = error_stats_service.ListGroupStatsRequest(
1231+
project_name="project_name_value",
1232+
page_token="page_token_value",
1233+
)
1234+
1235+
# Mock the actual call within the gRPC stub, and fake the request.
1236+
with mock.patch.object(type(client.transport.list_group_stats), "__call__") as call:
1237+
client.list_group_stats(request=request)
1238+
call.assert_called()
1239+
_, args, _ = call.mock_calls[0]
1240+
assert args[0] == error_stats_service.ListGroupStatsRequest(
1241+
project_name="project_name_value",
1242+
page_token="page_token_value",
1243+
)
1244+
1245+
1246+
@pytest.mark.asyncio
1247+
async def test_list_group_stats_empty_call_async():
1248+
# This test is a coverage failsafe to make sure that totally empty calls,
1249+
# i.e. request == None and no flattened fields passed, work.
1250+
client = ErrorStatsServiceAsyncClient(
1251+
credentials=ga_credentials.AnonymousCredentials(),
1252+
transport="grpc_asyncio",
1253+
)
1254+
1255+
# Mock the actual call within the gRPC stub, and fake the request.
1256+
with mock.patch.object(type(client.transport.list_group_stats), "__call__") as call:
1257+
# Designate an appropriate return value for the call.
1258+
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
1259+
error_stats_service.ListGroupStatsResponse(
1260+
next_page_token="next_page_token_value",
1261+
)
1262+
)
1263+
response = await client.list_group_stats()
1264+
call.assert_called()
1265+
_, args, _ = call.mock_calls[0]
1266+
assert args[0] == error_stats_service.ListGroupStatsRequest()
1267+
1268+
12181269
@pytest.mark.asyncio
12191270
async def test_list_group_stats_async(
12201271
transport: str = "grpc_asyncio",
@@ -1242,7 +1293,8 @@ async def test_list_group_stats_async(
12421293
# Establish that the underlying gRPC stub method was called.
12431294
assert len(call.mock_calls)
12441295
_, args, _ = call.mock_calls[0]
1245-
assert args[0] == error_stats_service.ListGroupStatsRequest()
1296+
request = error_stats_service.ListGroupStatsRequest()
1297+
assert args[0] == request
12461298

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

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

16641717

1718+
def test_list_events_non_empty_request_with_auto_populated_field():
1719+
# This test is a coverage failsafe to make sure that UUID4 fields are
1720+
# automatically populated, according to AIP-4235, with non-empty requests.
1721+
client = ErrorStatsServiceClient(
1722+
credentials=ga_credentials.AnonymousCredentials(),
1723+
transport="grpc",
1724+
)
1725+
1726+
# Populate all string fields in the request which are not UUID4
1727+
# since we want to check that UUID4 are populated automatically
1728+
# if they meet the requirements of AIP 4235.
1729+
request = error_stats_service.ListEventsRequest(
1730+
project_name="project_name_value",
1731+
group_id="group_id_value",
1732+
page_token="page_token_value",
1733+
)
1734+
1735+
# Mock the actual call within the gRPC stub, and fake the request.
1736+
with mock.patch.object(type(client.transport.list_events), "__call__") as call:
1737+
client.list_events(request=request)
1738+
call.assert_called()
1739+
_, args, _ = call.mock_calls[0]
1740+
assert args[0] == error_stats_service.ListEventsRequest(
1741+
project_name="project_name_value",
1742+
group_id="group_id_value",
1743+
page_token="page_token_value",
1744+
)
1745+
1746+
1747+
@pytest.mark.asyncio
1748+
async def test_list_events_empty_call_async():
1749+
# This test is a coverage failsafe to make sure that totally empty calls,
1750+
# i.e. request == None and no flattened fields passed, work.
1751+
client = ErrorStatsServiceAsyncClient(
1752+
credentials=ga_credentials.AnonymousCredentials(),
1753+
transport="grpc_asyncio",
1754+
)
1755+
1756+
# Mock the actual call within the gRPC stub, and fake the request.
1757+
with mock.patch.object(type(client.transport.list_events), "__call__") as call:
1758+
# Designate an appropriate return value for the call.
1759+
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
1760+
error_stats_service.ListEventsResponse(
1761+
next_page_token="next_page_token_value",
1762+
)
1763+
)
1764+
response = await client.list_events()
1765+
call.assert_called()
1766+
_, args, _ = call.mock_calls[0]
1767+
assert args[0] == error_stats_service.ListEventsRequest()
1768+
1769+
16651770
@pytest.mark.asyncio
16661771
async def test_list_events_async(
16671772
transport: str = "grpc_asyncio", request_type=error_stats_service.ListEventsRequest
@@ -1688,7 +1793,8 @@ async def test_list_events_async(
16881793
# Establish that the underlying gRPC stub method was called.
16891794
assert len(call.mock_calls)
16901795
_, args, _ = call.mock_calls[0]
1691-
assert args[0] == error_stats_service.ListEventsRequest()
1796+
request = error_stats_service.ListEventsRequest()
1797+
assert args[0] == request
16921798

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

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

20932200

2201+
def test_delete_events_non_empty_request_with_auto_populated_field():
2202+
# This test is a coverage failsafe to make sure that UUID4 fields are
2203+
# automatically populated, according to AIP-4235, with non-empty requests.
2204+
client = ErrorStatsServiceClient(
2205+
credentials=ga_credentials.AnonymousCredentials(),
2206+
transport="grpc",
2207+
)
2208+
2209+
# Populate all string fields in the request which are not UUID4
2210+
# since we want to check that UUID4 are populated automatically
2211+
# if they meet the requirements of AIP 4235.
2212+
request = error_stats_service.DeleteEventsRequest(
2213+
project_name="project_name_value",
2214+
)
2215+
2216+
# Mock the actual call within the gRPC stub, and fake the request.
2217+
with mock.patch.object(type(client.transport.delete_events), "__call__") as call:
2218+
client.delete_events(request=request)
2219+
call.assert_called()
2220+
_, args, _ = call.mock_calls[0]
2221+
assert args[0] == error_stats_service.DeleteEventsRequest(
2222+
project_name="project_name_value",
2223+
)
2224+
2225+
2226+
@pytest.mark.asyncio
2227+
async def test_delete_events_empty_call_async():
2228+
# This test is a coverage failsafe to make sure that totally empty calls,
2229+
# i.e. request == None and no flattened fields passed, work.
2230+
client = ErrorStatsServiceAsyncClient(
2231+
credentials=ga_credentials.AnonymousCredentials(),
2232+
transport="grpc_asyncio",
2233+
)
2234+
2235+
# Mock the actual call within the gRPC stub, and fake the request.
2236+
with mock.patch.object(type(client.transport.delete_events), "__call__") as call:
2237+
# Designate an appropriate return value for the call.
2238+
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
2239+
error_stats_service.DeleteEventsResponse()
2240+
)
2241+
response = await client.delete_events()
2242+
call.assert_called()
2243+
_, args, _ = call.mock_calls[0]
2244+
assert args[0] == error_stats_service.DeleteEventsRequest()
2245+
2246+
20942247
@pytest.mark.asyncio
20952248
async def test_delete_events_async(
20962249
transport: str = "grpc_asyncio",
@@ -2116,7 +2269,8 @@ async def test_delete_events_async(
21162269
# Establish that the underlying gRPC stub method was called.
21172270
assert len(call.mock_calls)
21182271
_, args, _ = call.mock_calls[0]
2119-
assert args[0] == error_stats_service.DeleteEventsRequest()
2272+
request = error_stats_service.DeleteEventsRequest()
2273+
assert args[0] == request
21202274

21212275
# Establish that the response is the type that we expect.
21222276
assert isinstance(response, error_stats_service.DeleteEventsResponse)

0 commit comments

Comments
 (0)