@@ -254,39 +254,6 @@ async def test_send_each_async():
254254 assert isinstance (response .exception , exceptions .InvalidArgumentError )
255255 assert response .message_id is None
256256
257-
258- # @pytest.mark.asyncio
259- # async def test_send_each_async_error():
260- # messages = [
261- # messaging.Message(
262- # topic='foo-bar', notification=messaging.Notification('Title', 'Body')),
263- # messaging.Message(
264- # topic='foo-bar', notification=messaging.Notification('Title', 'Body')),
265- # messaging.Message(
266- # token='not-a-token', notification=messaging.Notification('Title', 'Body')),
267- # ]
268-
269- # batch_response = await messaging.send_each_async(messages, dry_run=True)
270-
271- # assert batch_response.success_count == 2
272- # assert batch_response.failure_count == 1
273- # assert len(batch_response.responses) == 3
274-
275- # response = batch_response.responses[0]
276- # assert response.success is True
277- # assert response.exception is None
278- # assert re.match('^projects/.*/messages/.*$', response.message_id)
279-
280- # response = batch_response.responses[1]
281- # assert response.success is True
282- # assert response.exception is None
283- # assert re.match('^projects/.*/messages/.*$', response.message_id)
284-
285- # response = batch_response.responses[2]
286- # assert response.success is False
287- # assert isinstance(response.exception, exceptions.InvalidArgumentError)
288- # assert response.message_id is None
289-
290257@pytest .mark .asyncio
291258async def test_send_each_async_500 ():
292259 messages = []
@@ -303,3 +270,19 @@ async def test_send_each_async_500():
303270 assert response .success is True
304271 assert response .exception is None
305272 assert re .match ('^projects/.*/messages/.*$' , response .message_id )
273+
274+ @pytest .mark .asyncio
275+ async def test_send_each_for_multicast_async ():
276+ multicast = messaging .MulticastMessage (
277+ notification = messaging .Notification ('Title' , 'Body' ),
278+ tokens = ['not-a-token' , 'also-not-a-token' ])
279+
280+ batch_response = await messaging .send_each_for_multicast_async (multicast )
281+
282+ assert batch_response .success_count == 0
283+ assert batch_response .failure_count == 2
284+ assert len (batch_response .responses ) == 2
285+ for response in batch_response .responses :
286+ assert response .success is False
287+ assert response .exception is not None
288+ assert response .message_id is None
0 commit comments