diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-09-21 13:34:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 13:34:26 -0400 |
commit | 4054dfa409fa17b45ab8f265813994956ed97bae (patch) | |
tree | 8a2c2a5700dcd62f1b8ad8593d0b25c9c7b32e55 /tests | |
parent | Add types to http.site (#10867) (diff) | |
download | synapse-4054dfa409fa17b45ab8f265813994956ed97bae.tar.xz |
Add type hints for event streams. (#10856)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/handlers/test_receipts.py | 2 | ||||
-rw-r--r-- | tests/handlers/test_typing.py | 46 | ||||
-rw-r--r-- | tests/rest/client/test_shadow_banned.py | 10 | ||||
-rw-r--r-- | tests/rest/client/test_typing.py | 10 |
4 files changed, 55 insertions, 13 deletions
diff --git a/tests/handlers/test_receipts.py b/tests/handlers/test_receipts.py index 732a12c9bd..5de89c873b 100644 --- a/tests/handlers/test_receipts.py +++ b/tests/handlers/test_receipts.py @@ -23,7 +23,7 @@ from tests import unittest class ReceiptsTestCase(unittest.HomeserverTestCase): def prepare(self, reactor, clock, hs): - self.event_source = hs.get_event_sources().sources["receipt"] + self.event_source = hs.get_event_sources().sources.receipt # In the first param of _test_filters_hidden we use "hidden" instead of # ReadReceiptEventFields.MSC2285_HIDDEN. We do this because we're mocking diff --git a/tests/handlers/test_typing.py b/tests/handlers/test_typing.py index fa3cff598e..000f9b9fde 100644 --- a/tests/handlers/test_typing.py +++ b/tests/handlers/test_typing.py @@ -89,7 +89,7 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.handler = hs.get_typing_handler() - self.event_source = hs.get_event_sources().sources["typing"] + self.event_source = hs.get_event_sources().sources.typing self.datastore = hs.get_datastore() self.datastore.get_destination_retry_timings = Mock( @@ -171,7 +171,9 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 1) events = self.get_success( - self.event_source.get_new_events(room_ids=[ROOM_ID], from_key=0) + self.event_source.get_new_events( + user=U_APPLE, from_key=0, limit=None, room_ids=[ROOM_ID], is_guest=False + ) ) self.assertEquals( events[0], @@ -239,7 +241,9 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 1) events = self.get_success( - self.event_source.get_new_events(room_ids=[ROOM_ID], from_key=0) + self.event_source.get_new_events( + user=U_APPLE, from_key=0, limit=None, room_ids=[ROOM_ID], is_guest=False + ) ) self.assertEquals( events[0], @@ -276,7 +280,13 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 0) events = self.get_success( - self.event_source.get_new_events(room_ids=[OTHER_ROOM_ID], from_key=0) + self.event_source.get_new_events( + user=U_APPLE, + from_key=0, + limit=None, + room_ids=[OTHER_ROOM_ID], + is_guest=False, + ) ) self.assertEquals(events[0], []) self.assertEquals(events[1], 0) @@ -324,7 +334,9 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 1) events = self.get_success( - self.event_source.get_new_events(room_ids=[ROOM_ID], from_key=0) + self.event_source.get_new_events( + user=U_APPLE, from_key=0, limit=None, room_ids=[ROOM_ID], is_guest=False + ) ) self.assertEquals( events[0], @@ -350,7 +362,13 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 1) events = self.get_success( - self.event_source.get_new_events(room_ids=[ROOM_ID], from_key=0) + self.event_source.get_new_events( + user=U_APPLE, + from_key=0, + limit=None, + room_ids=[ROOM_ID], + is_guest=False, + ) ) self.assertEquals( events[0], @@ -369,7 +387,13 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 2) events = self.get_success( - self.event_source.get_new_events(room_ids=[ROOM_ID], from_key=1) + self.event_source.get_new_events( + user=U_APPLE, + from_key=1, + limit=None, + room_ids=[ROOM_ID], + is_guest=False, + ) ) self.assertEquals( events[0], @@ -392,7 +416,13 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 3) events = self.get_success( - self.event_source.get_new_events(room_ids=[ROOM_ID], from_key=0) + self.event_source.get_new_events( + user=U_APPLE, + from_key=0, + limit=None, + room_ids=[ROOM_ID], + is_guest=False, + ) ) self.assertEquals( events[0], diff --git a/tests/rest/client/test_shadow_banned.py b/tests/rest/client/test_shadow_banned.py index 6a0d9a82be..b0c44af033 100644 --- a/tests/rest/client/test_shadow_banned.py +++ b/tests/rest/client/test_shadow_banned.py @@ -193,7 +193,7 @@ class RoomTestCase(_ShadowBannedBase): self.assertEquals(200, channel.code) # There should be no typing events. - event_source = self.hs.get_event_sources().sources["typing"] + event_source = self.hs.get_event_sources().sources.typing self.assertEquals(event_source.get_current_key(), 0) # The other user can join and send typing events. @@ -210,7 +210,13 @@ class RoomTestCase(_ShadowBannedBase): # These appear in the room. self.assertEquals(event_source.get_current_key(), 1) events = self.get_success( - event_source.get_new_events(from_key=0, room_ids=[room_id]) + event_source.get_new_events( + user=UserID.from_string(self.other_user_id), + from_key=0, + limit=None, + room_ids=[room_id], + is_guest=False, + ) ) self.assertEquals( events[0], diff --git a/tests/rest/client/test_typing.py b/tests/rest/client/test_typing.py index b54b004733..ee0abd5295 100644 --- a/tests/rest/client/test_typing.py +++ b/tests/rest/client/test_typing.py @@ -41,7 +41,7 @@ class RoomTypingTestCase(unittest.HomeserverTestCase): federation_client=Mock(), ) - self.event_source = hs.get_event_sources().sources["typing"] + self.event_source = hs.get_event_sources().sources.typing hs.get_federation_handler = Mock() @@ -76,7 +76,13 @@ class RoomTypingTestCase(unittest.HomeserverTestCase): self.assertEquals(self.event_source.get_current_key(), 1) events = self.get_success( - self.event_source.get_new_events(from_key=0, room_ids=[self.room_id]) + self.event_source.get_new_events( + user=UserID.from_string(self.user_id), + from_key=0, + limit=None, + room_ids=[self.room_id], + is_guest=False, + ) ) self.assertEquals( events[0], |