@@ -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
12191270async 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
16661771async 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
20952248async 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