mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
test_e2ee_push_notification: Improve tests to cover more cases.
This commit adds a test and updates a few existing tests to cover more cases related to send push notifications. * We no longer mock the 'send_push_notifications_legacy' function while testing 'send_push_notifications' codepath and vice-versa. This makes the tests more realistic as both functions gets called in 'handle_push_notification'. This covers the case when only old clients (which don't support E2EE) exists for a user. Or only updated clients (which supports E2EE) exist. * Adds a test 'test_both_old_and_new_client_coexists' for the case when a user has both type of clients at an instant i.e. they have updated a few devices only.
This commit is contained in:
committed by
Tim Abbott
parent
d91a6be3f1
commit
5616be4afa
@@ -1317,11 +1317,7 @@ def send_push_notifications_legacy(
|
||||
PushDeviceToken.objects.filter(user=user_profile, kind=PushDeviceToken.APNS).order_by("id")
|
||||
)
|
||||
|
||||
# Added this nocoverage check for this commit. We plan to add a commit
|
||||
# which will remove the mocking of 'send_push_notifications_legacy'
|
||||
# in 'test_e2ee_push_notifications' - and this case will be covered
|
||||
# there as a part of that broader effort.
|
||||
if len(android_devices) + len(apple_devices) == 0: # nocoverage
|
||||
if len(android_devices) + len(apple_devices) == 0:
|
||||
logger.info(
|
||||
"Skipping legacy push notifications for user %s because there are no registered devices",
|
||||
user_profile.id,
|
||||
|
||||
Reference in New Issue
Block a user