mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Fix tests
This commit is contained in:
parent
c7b99a1180
commit
476a89707a
@ -160,7 +160,7 @@ class SlavedEventStoreTestCase(BaseSlavedStoreTestCase):
|
|||||||
self.check(
|
self.check(
|
||||||
"get_unread_event_push_actions_by_room_for_user",
|
"get_unread_event_push_actions_by_room_for_user",
|
||||||
[ROOM_ID, USER_ID_2, event1.event_id],
|
[ROOM_ID, USER_ID_2, event1.event_id],
|
||||||
{"highlight_count": 0, "notify_count": 0},
|
{"highlight_count": 0, "notify_count": 0, "unread_count": 0},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.persist(
|
self.persist(
|
||||||
@ -173,7 +173,7 @@ class SlavedEventStoreTestCase(BaseSlavedStoreTestCase):
|
|||||||
self.check(
|
self.check(
|
||||||
"get_unread_event_push_actions_by_room_for_user",
|
"get_unread_event_push_actions_by_room_for_user",
|
||||||
[ROOM_ID, USER_ID_2, event1.event_id],
|
[ROOM_ID, USER_ID_2, event1.event_id],
|
||||||
{"highlight_count": 0, "notify_count": 1},
|
{"highlight_count": 0, "notify_count": 1, "unread_count": 1},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.persist(
|
self.persist(
|
||||||
@ -188,7 +188,7 @@ class SlavedEventStoreTestCase(BaseSlavedStoreTestCase):
|
|||||||
self.check(
|
self.check(
|
||||||
"get_unread_event_push_actions_by_room_for_user",
|
"get_unread_event_push_actions_by_room_for_user",
|
||||||
[ROOM_ID, USER_ID_2, event1.event_id],
|
[ROOM_ID, USER_ID_2, event1.event_id],
|
||||||
{"highlight_count": 1, "notify_count": 2},
|
{"highlight_count": 1, "notify_count": 2, "unread_count": 2},
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_rooms_for_user_with_stream_ordering(self):
|
def test_get_rooms_for_user_with_stream_ordering(self):
|
||||||
|
@ -55,13 +55,17 @@ class EventPushActionsStoreTestCase(tests.unittest.TestCase):
|
|||||||
user_id = "@user1235:example.com"
|
user_id = "@user1235:example.com"
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _assert_counts(noitf_count, highlight_count):
|
def _assert_counts(unread_count, notif_count, highlight_count):
|
||||||
counts = yield self.store.db.runInteraction(
|
counts = yield self.store.db.runInteraction(
|
||||||
"", self.store._get_unread_counts_by_pos_txn, room_id, user_id, 0
|
"", self.store._get_unread_counts_by_pos_txn, room_id, user_id, 0
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
counts,
|
counts,
|
||||||
{"notify_count": noitf_count, "highlight_count": highlight_count},
|
{
|
||||||
|
"unread_count": unread_count,
|
||||||
|
"notify_count": notif_count,
|
||||||
|
"highlight_count": highlight_count,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@ -96,23 +100,23 @@ class EventPushActionsStoreTestCase(tests.unittest.TestCase):
|
|||||||
stream,
|
stream,
|
||||||
)
|
)
|
||||||
|
|
||||||
yield _assert_counts(0, 0)
|
yield _assert_counts(0, 0, 0)
|
||||||
yield _inject_actions(1, PlAIN_NOTIF)
|
yield _inject_actions(1, PlAIN_NOTIF)
|
||||||
yield _assert_counts(1, 0)
|
yield _assert_counts(1, 1, 0)
|
||||||
yield _rotate(2)
|
yield _rotate(2)
|
||||||
yield _assert_counts(1, 0)
|
yield _assert_counts(1, 1, 0)
|
||||||
|
|
||||||
yield _inject_actions(3, PlAIN_NOTIF)
|
yield _inject_actions(3, PlAIN_NOTIF)
|
||||||
yield _assert_counts(2, 0)
|
yield _assert_counts(2, 2, 0)
|
||||||
yield _rotate(4)
|
yield _rotate(4)
|
||||||
yield _assert_counts(2, 0)
|
yield _assert_counts(2, 2, 0)
|
||||||
|
|
||||||
yield _inject_actions(5, PlAIN_NOTIF)
|
yield _inject_actions(5, PlAIN_NOTIF)
|
||||||
yield _mark_read(3, 3)
|
yield _mark_read(3, 3)
|
||||||
yield _assert_counts(1, 0)
|
yield _assert_counts(1, 1, 0)
|
||||||
|
|
||||||
yield _mark_read(5, 5)
|
yield _mark_read(5, 5)
|
||||||
yield _assert_counts(0, 0)
|
yield _assert_counts(0, 0, 0)
|
||||||
|
|
||||||
yield _inject_actions(6, PlAIN_NOTIF)
|
yield _inject_actions(6, PlAIN_NOTIF)
|
||||||
yield _rotate(7)
|
yield _rotate(7)
|
||||||
@ -121,17 +125,17 @@ class EventPushActionsStoreTestCase(tests.unittest.TestCase):
|
|||||||
table="event_push_actions", keyvalues={"1": 1}, desc=""
|
table="event_push_actions", keyvalues={"1": 1}, desc=""
|
||||||
)
|
)
|
||||||
|
|
||||||
yield _assert_counts(1, 0)
|
yield _assert_counts(1, 1, 0)
|
||||||
|
|
||||||
yield _mark_read(7, 7)
|
yield _mark_read(7, 7)
|
||||||
yield _assert_counts(0, 0)
|
yield _assert_counts(0, 0, 0)
|
||||||
|
|
||||||
yield _inject_actions(8, HIGHLIGHT)
|
yield _inject_actions(8, HIGHLIGHT)
|
||||||
yield _assert_counts(1, 1)
|
yield _assert_counts(1, 1, 1)
|
||||||
yield _rotate(9)
|
yield _rotate(9)
|
||||||
yield _assert_counts(1, 1)
|
yield _assert_counts(1, 1, 1)
|
||||||
yield _rotate(10)
|
yield _rotate(10)
|
||||||
yield _assert_counts(1, 1)
|
yield _assert_counts(1, 1, 1)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_find_first_stream_ordering_after_ts(self):
|
def test_find_first_stream_ordering_after_ts(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user