Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Change tests to expect badge count when no read receipt
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Jun 9, 2022
1 parent d411eca commit 03eb606
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/push/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def test_push_unread_count_group_by_room(self) -> None:
# Carry out our option-value specific test
#
# This push should still only contain an unread count of 1 (for 1 unread room)
self._check_push_attempt(6, 1)
self._check_push_attempt(7, 1)

@override_config({"push": {"group_unread_count_by_room": False}})
def test_push_unread_count_message_count(self) -> None:
Expand All @@ -591,7 +591,7 @@ def test_push_unread_count_message_count(self) -> None:
#
# We're counting every unread message, so there should now be 3 since the
# last read receipt
self._check_push_attempt(6, 3)
self._check_push_attempt(7, 3)

def _test_push_unread_count(self) -> None:
"""
Expand Down Expand Up @@ -641,18 +641,18 @@ def _test_push_unread_count(self) -> None:
response = self.helper.send(
room_id, body="Hello there!", tok=other_access_token
)
# To get an unread count, the user who is getting notified has to have a read
# position in the room. We'll set the read position to this event in a moment

first_message_event_id = response["event_id"]

expected_push_attempts = 1
self._check_push_attempt(expected_push_attempts, 0)
self._check_push_attempt(expected_push_attempts, 1)

self._send_read_request(access_token, first_message_event_id, room_id)

# Unread count has not changed. Therefore, ensure that read request does not
# trigger a push notification.
self.assertEqual(len(self.push_attempts), 1)
# Unread count has changed. Therefore, ensure that read request triggers
# a push notification.
expected_push_attempts += 1
self.assertEqual(len(self.push_attempts), expected_push_attempts)

# Send another message
response2 = self.helper.send(
Expand Down

0 comments on commit 03eb606

Please sign in to comment.