change(fcm): Remove deprecated `send_all()` and `send_multicast()` APIs by jonathanedey · Pull Request #890 · firebase/firebase-admin-python · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 0 additions & 122 deletions firebase_admin/_gapic_utils.py

This file was deleted.

118 changes: 0 additions & 118 deletions firebase_admin/messaging.py
65 changes: 0 additions & 65 deletions integration/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,71 +149,6 @@ def test_send_each_for_multicast():
assert response.exception is not None
assert response.message_id is None

@pytest.mark.skip(reason="Replaced with test_send_each")
def test_send_all():
messages = [
messaging.Message(
topic='foo-bar', notification=messaging.Notification('Title', 'Body')),
messaging.Message(
topic='foo-bar', notification=messaging.Notification('Title', 'Body')),
messaging.Message(
token='not-a-token', notification=messaging.Notification('Title', 'Body')),
]

batch_response = messaging.send_all(messages, dry_run=True)

assert batch_response.success_count == 2
assert batch_response.failure_count == 1
assert len(batch_response.responses) == 3

response = batch_response.responses[0]
assert response.success is True
assert response.exception is None
assert re.match('^projects/.*/messages/.*$', response.message_id)

response = batch_response.responses[1]
assert response.success is True
assert response.exception is None
assert re.match('^projects/.*/messages/.*$', response.message_id)

response = batch_response.responses[2]
assert response.success is False
assert isinstance(response.exception, exceptions.InvalidArgumentError)
assert response.message_id is None

@pytest.mark.skip(reason="Replaced with test_send_each_500")
def test_send_all_500():
messages = []
for msg_number in range(500):
topic = 'foo-bar-{0}'.format(msg_number % 10)
messages.append(messaging.Message(topic=topic))

batch_response = messaging.send_all(messages, dry_run=True)

assert batch_response.success_count == 500
assert batch_response.failure_count == 0
assert len(batch_response.responses) == 500
for response in batch_response.responses:
assert response.success is True
assert response.exception is None
assert re.match('^projects/.*/messages/.*$', response.message_id)

@pytest.mark.skip(reason="Replaced with test_send_each_for_multicast")
def test_send_multicast():
multicast = messaging.MulticastMessage(
notification=messaging.Notification('Title', 'Body'),
tokens=['not-a-token', 'also-not-a-token'])

batch_response = messaging.send_multicast(multicast)

assert batch_response.success_count == 0
assert batch_response.failure_count == 2
assert len(batch_response.responses) == 2
for response in batch_response.responses:
assert response.success is False
assert response.exception is not None
assert response.message_id is None

def test_subscribe():
resp = messaging.subscribe_to_topic(_REGISTRATION_TOKEN, 'mock-topic')
assert resp.success_count + resp.failure_count == 1
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ respx == 0.22.0

cachecontrol >= 0.12.14
google-api-core[grpc] >= 1.22.1, < 3.0.0dev; platform.python_implementation != 'PyPy'
google-api-python-client >= 1.7.8

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's include this change in the release notes, as this affects the bundle size

google-cloud-firestore >= 2.19.0; platform.python_implementation != 'PyPy'
google-cloud-storage >= 1.37.1
pyjwt[crypto] >= 2.5.0
Expand Down
1 change: 0 additions & 1 deletion setup.py
Loading