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

Commit

Permalink
Add an additional test.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Jan 28, 2021
1 parent d2d5088 commit 0bd3edb
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion tests/push/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,36 @@ def test_multiple_members_email(self):
# We should get emailed about those messages
self._check_for_mail()

def test_multiple_rooms(self):
# We want to test multiple notifications from multiple rooms., so we pause processing of push
# while we send messages.
self.pusher._pause_processing()

# Create a simple room with multiple other users
rooms = [
self.helper.create_room_as(self.user_id, tok=self.access_token),
self.helper.create_room_as(self.user_id, tok=self.access_token),
]

for room, other in zip(rooms, self.others):
self.helper.invite(
room=room, src=self.user_id, tok=self.access_token, targ=other.id
)
self.helper.join(room=room, user=other.id, tok=other.token)

# The other users send some messages
self.helper.send(rooms[0], body="Hi!", tok=self.others[0].token)
self.helper.send(rooms[1], body="There!", tok=self.others[1].token)
self.helper.send(rooms[1], body="There!", tok=self.others[1].token)

# Nothing should have happened yet, as we're paused.
assert not self.email_attempts

self.pusher._resume_processing()

# We should get emailed about those messages
self._check_for_mail()

def test_empty_room(self):
"""All users leaving a room shouldn't cause the pusher to break."""
# Create a simple room with two users
Expand All @@ -211,7 +241,7 @@ def test_empty_room(self):
# We should get emailed about that message
self._check_for_mail()

def test_empty_room_multi_message(self):
def test_empty_room_multiple_message(self):
"""All users leaving a room shouldn't cause the pusher to break."""
# Create a simple room with two users
room = self.helper.create_room_as(self.user_id, tok=self.access_token)
Expand Down

0 comments on commit 0bd3edb

Please sign in to comment.