summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-07 12:10:23 +0100
committerErik Johnston <erik@matrix.org>2019-06-07 12:15:33 +0100
commit2ebeda48b2e6ba522fe049ee7ef13450f6839e1b (patch)
tree50a4faf6fa96dea3e4a3627654f3393d0fd3e290 /tests
parentRefactor email tests (diff)
downloadsynapse-2ebeda48b2e6ba522fe049ee7ef13450f6839e1b.tar.xz
Add test
Diffstat (limited to 'tests')
-rw-r--r--tests/push/test_email.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/push/test_email.py b/tests/push/test_email.py
index 62b3c2a99d..c10b65d4b8 100644
--- a/tests/push/test_email.py
+++ b/tests/push/test_email.py
@@ -108,7 +108,7 @@ class EmailPusherTests(HomeserverTestCase):
         )
         token_id = user_tuple["token_id"]
 
-        self.get_success(
+        self.pusher = self.get_success(
             self.hs.get_pusherpool().add_pusher(
                 user_id=self.user_id,
                 access_token=token_id,
@@ -137,6 +137,33 @@ class EmailPusherTests(HomeserverTestCase):
         # We should get emailed about that message
         self._check_for_mail()
 
+    def test_multiple_members_email(self):
+        # We want to test multiple notifications, so we pause processing of push
+        # while we send messages.
+        self.pusher._pause_processing()
+
+        # Create a simple room with multiple other users
+        room = self.helper.create_room_as(self.user_id, tok=self.access_token)
+
+        for other in 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(room, body="Hi!", tok=self.others[0].token)
+        self.helper.send(room, body="There!", tok=self.others[1].token)
+        self.helper.send(room, 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 _check_for_mail(self):
         "Check that the user receives an email notification"