Skip to content

Commit ecec7fa

Browse files
committed
Fix CI
1 parent 07376bd commit ecec7fa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

firebase_admin/messaging.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ def _message_data(self, message, dry_run):
453453
return data
454454

455455
def _postproc(self, resp, body):
456+
"""Handle response from batch API request."""
456457
if resp.status is not 200:
457458
data = {}
458459
try:

tests/test_messaging.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def test_invalid_tokens_type(self, tokens):
5555

5656
def test_tokens_over_one_hundred(self):
5757
with pytest.raises(ValueError) as excinfo:
58-
messaging.MulticastMessage(tokens=['token' for i in xrange(0, 101)])
58+
messaging.MulticastMessage(tokens=['token' for _ in range(0, 101)])
5959
expected = 'MulticastMessage.tokens must not contain more than 100 tokens.'
6060
assert str(excinfo.value) == expected
6161

6262
def test_tokens_type(self):
6363
messaging.MulticastMessage(tokens=['token'])
64-
messaging.MulticastMessage(tokens=['token' for i in xrange(0, 100)])
64+
messaging.MulticastMessage(tokens=['token' for _ in range(0, 100)])
6565

6666

6767
class TestMessageEncoder(object):
@@ -1401,7 +1401,7 @@ def test_invalid_send_all(self, msg):
14011401
def test_invalid_over_one_hundred(self):
14021402
msg = messaging.Message(topic='foo')
14031403
with pytest.raises(ValueError) as excinfo:
1404-
messaging.send_all([msg for i in xrange(0, 101)])
1404+
messaging.send_all([msg for _ in range(0, 101)])
14051405
expected = 'send_all messages must not contain more than 100 messages.'
14061406
assert str(excinfo.value) == expected
14071407

@@ -1441,7 +1441,7 @@ def test_send_all_non_error_non_200_detailed_error(self):
14411441
payload=self._batch_payload([(200, success_payload), (202, error_payload)]))
14421442
msg = messaging.Message(topic='foo')
14431443
with pytest.raises(messaging.ApiCallError) as excinfo:
1444-
batch_response = messaging.send_all([msg, msg], dry_run=True)
1444+
messaging.send_all([msg, msg], dry_run=True)
14451445
assert str(excinfo.value) == 'test error'
14461446
assert str(excinfo.value.code) == 'invalid-argument'
14471447

@@ -1458,7 +1458,6 @@ def test_send_all_non_error_non_200_canonical_error_code(self):
14581458
msg = messaging.Message(topic='foo')
14591459
with pytest.raises(messaging.ApiCallError) as excinfo:
14601460
messaging.send_all([msg, msg], dry_run=True)
1461-
expected = 'send_all messages must not contain more than 100 messages.'
14621461
assert str(excinfo.value) == 'test error'
14631462
assert str(excinfo.value.code) == 'registration-token-not-registered'
14641463

@@ -1689,7 +1688,7 @@ def test_send_multicast_non_error_non_200_detailed_error(self):
16891688
payload=self._batch_payload([(200, success_payload), (202, error_payload)]))
16901689
msg = messaging.MulticastMessage(tokens=['foo', 'foo'])
16911690
with pytest.raises(messaging.ApiCallError) as excinfo:
1692-
batch_response = messaging.send_multicast(msg, dry_run=True)
1691+
messaging.send_multicast(msg, dry_run=True)
16931692
assert str(excinfo.value) == 'test error'
16941693
assert str(excinfo.value.code) == 'invalid-argument'
16951694

@@ -1788,7 +1787,7 @@ def test_send_multicast_canonical_error_code(self, status):
17881787
assert str(exception.code) == 'registration-token-not-registered'
17891788

17901789
@pytest.mark.parametrize('status', HTTP_ERRORS)
1791-
def test_send_multicast_canonical_error_code(self, status):
1790+
def test_send_multicast_fcm_error_code(self, status):
17921791
success_payload = json.dumps({'name': 'message-id'})
17931792
error_payload = json.dumps({
17941793
'error': {

0 commit comments

Comments
 (0)