summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2022-07-06 14:53:31 -0400
committerPatrick Cloke <patrickc@matrix.org>2022-08-05 08:18:31 -0400
commitfd972df8f9ca9a6805d532a5502fc89478bddc67 (patch)
treedb655551fa3fefa9fa7cab3b022cd09eef4ea390 /tests
parentSend the thread ID over replication. (diff)
downloadsynapse-fd972df8f9ca9a6805d532a5502fc89478bddc67.tar.xz
Mark thread notifications as read.
Diffstat (limited to 'tests')
-rw-r--r--tests/storage/test_event_push_actions.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/storage/test_event_push_actions.py b/tests/storage/test_event_push_actions.py
index 53a68b6d17..175437c765 100644
--- a/tests/storage/test_event_push_actions.py
+++ b/tests/storage/test_event_push_actions.py
@@ -252,14 +252,14 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
         def _rotate() -> None:
             self.get_success(self.store._rotate_notifs())
 
-        def _mark_read(event_id: str) -> None:
+        def _mark_read(event_id: str, thread_id: Optional[str] = None) -> None:
             self.get_success(
                 self.store.insert_receipt(
                     room_id,
                     "m.read",
                     user_id=user_id,
                     event_ids=[event_id],
-                    thread_id=None,
+                    thread_id=thread_id,
                     data={},
                 )
             )
@@ -288,9 +288,12 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
         _create_event()
         _create_event(thread_id=thread_id)
         _mark_read(event_id)
+        _assert_counts(1, 0, 0, 3, 0, 0)
+        _mark_read(event_id, thread_id)
         _assert_counts(1, 0, 0, 1, 0, 0)
 
         _mark_read(last_event_id)
+        _mark_read(last_event_id, thread_id)
         _assert_counts(0, 0, 0, 0, 0, 0)
 
         _create_event()
@@ -304,6 +307,7 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
         _assert_counts(1, 0, 0, 1, 0, 0)
 
         _mark_read(last_event_id)
+        _mark_read(last_event_id, thread_id)
         _assert_counts(0, 0, 0, 0, 0, 0)
 
         _create_event(True)
@@ -320,23 +324,28 @@ class EventPushActionsStoreTestCase(HomeserverTestCase):
         # works.
         _create_event()
         _rotate()
-        _assert_counts(2, 0, 1, 1, 1, 1)
+        _assert_counts(2, 1, 1, 1, 1, 1)
 
         _create_event(thread_id=thread_id)
         _rotate()
-        _assert_counts(2, 0, 1, 2, 0, 1)
+        _assert_counts(2, 1, 1, 2, 1, 1)
 
         # Check that sending read receipts at different points results in the
         # right counts.
         _mark_read(event_id)
+        _assert_counts(1, 0, 0, 2, 1, 1)
+        _mark_read(event_id, thread_id)
         _assert_counts(1, 0, 0, 1, 0, 0)
         _mark_read(last_event_id)
+        _assert_counts(0, 0, 0, 1, 0, 0)
+        _mark_read(last_event_id, thread_id)
         _assert_counts(0, 0, 0, 0, 0, 0)
 
         _create_event(True)
         _create_event(True, thread_id)
         _assert_counts(1, 1, 1, 1, 1, 1)
         _mark_read(last_event_id)
+        _mark_read(last_event_id, thread_id)
         _assert_counts(0, 0, 0, 0, 0, 0)
         _rotate()
         _assert_counts(0, 0, 0, 0, 0, 0)