diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-09-01 22:30:09 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-09-02 10:53:16 +0100 |
commit | 7e22afbc7c53af8635262aa25d1663900f6bc1c4 (patch) | |
tree | 49aab6ebd4731570d6786ad1c55b7182e72c88d3 /tests/handlers | |
parent | Make the config directory if the directory doesn't exisit when generating config (diff) | |
download | synapse-7e22afbc7c53af8635262aa25d1663900f6bc1c4.tar.xz |
Ensure that event source unit tests could cope with get_new_events_for_user() returning a Deferred
Diffstat (limited to 'tests/handlers')
-rw-r--r-- | tests/handlers/test_presence.py | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py index 2eea474391..b8309bc063 100644 --- a/tests/handlers/test_presence.py +++ b/tests/handlers/test_presence.py @@ -632,9 +632,12 @@ class PresencePushTestCase(unittest.TestCase): {"presence": ONLINE} ) + (events, _) = yield self.event_source.get_new_events_for_user( + self.u_apple, 0, None + ) + self.assertEquals(self.event_source.get_current_key(), 1) - self.assertEquals( - self.event_source.get_new_events_for_user(self.u_apple, 0, None)[0], + self.assertEquals(events, [ {"type": "m.presence", "content": { @@ -680,11 +683,12 @@ class PresencePushTestCase(unittest.TestCase): "state": OFFLINE}, ], presence) + (events, _) = yield self.event_source.get_new_events_for_user( + self.u_apple, 1, None + ) + self.assertEquals(self.event_source.get_current_key(), 2) - self.assertEquals( - self.event_source.get_new_events_for_user( - self.u_banana, 1, None - )[0], + self.assertEquals(events, [ {"type": "m.presence", "content": { @@ -760,11 +764,12 @@ class PresencePushTestCase(unittest.TestCase): ) ) + (events, _) = yield self.event_source.get_new_events_for_user( + self.u_apple, 0, None + ) + self.assertEquals(self.event_source.get_current_key(), 1) - self.assertEquals( - self.event_source.get_new_events_for_user( - self.u_apple, 0, None - )[0], + self.assertEquals(events, [ {"type": "m.presence", "content": { @@ -804,11 +809,12 @@ class PresencePushTestCase(unittest.TestCase): "a-room" ) + (events, _) = yield self.event_source.get_new_events_for_user( + self.u_apple, 0, None + ) + self.assertEquals(self.event_source.get_current_key(), 1) - self.assertEquals( - self.event_source.get_new_events_for_user( - self.u_apple, 0, None - )[0], + self.assertEquals(events, [ {"type": "m.presence", "content": { |