diff options
author | Patrick Cloke <patrickc@matrix.org> | 2022-07-06 14:53:31 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2022-08-05 08:18:31 -0400 |
commit | fd972df8f9ca9a6805d532a5502fc89478bddc67 (patch) | |
tree | db655551fa3fefa9fa7cab3b022cd09eef4ea390 /tests | |
parent | Send the thread ID over replication. (diff) | |
download | synapse-fd972df8f9ca9a6805d532a5502fc89478bddc67.tar.xz |
Mark thread notifications as read.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/storage/test_event_push_actions.py | 17 |
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) |