@@ -87,6 +87,14 @@ def test_send_malformed_token():
8787 with pytest .raises (exceptions .InvalidArgumentError ):
8888 messaging .send (msg , dry_run = True )
8989
90+ def test_send_invalid_fid ():
91+ msg = messaging .Message (
92+ fid = 'not-a-fid' ,
93+ notification = messaging .Notification ('test-title' , 'test-body' )
94+ )
95+ with pytest .raises (exceptions .InvalidArgumentError ):
96+ messaging .send (msg , dry_run = True )
97+
9098def test_send_each ():
9199 messages = [
92100 messaging .Message (
@@ -149,6 +157,21 @@ def test_send_each_for_multicast():
149157 assert response .exception is not None
150158 assert response .message_id is None
151159
160+ def test_send_each_for_multicast_fids ():
161+ multicast = messaging .MulticastMessage (
162+ notification = messaging .Notification ('Title' , 'Body' ),
163+ fids = ['not-a-fid' , 'also-not-a-fid' ])
164+
165+ batch_response = messaging .send_each_for_multicast (multicast )
166+
167+ assert batch_response .success_count == 0
168+ assert batch_response .failure_count == 2
169+ assert len (batch_response .responses ) == 2
170+ for response in batch_response .responses :
171+ assert response .success is False
172+ assert response .exception is not None
173+ assert response .message_id is None
174+
152175def test_subscribe ():
153176 resp = messaging .subscribe_to_topic (_REGISTRATION_TOKEN , 'mock-topic' )
154177 assert resp .success_count + resp .failure_count == 1
0 commit comments