Skip to content

Commit

Permalink
Ensure that event source unit tests could cope with get_new_events_fo…
Browse files Browse the repository at this point in the history
…r_user() returning a Deferred
  • Loading branch information
Paul "LeoNerd" Evans committed Sep 2, 2014
1 parent 30572e2 commit 7e22afb
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions tests/handlers/test_presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,12 @@ def test_push_local(self):
{"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": {
Expand Down Expand Up @@ -680,11 +683,12 @@ def test_push_local(self):
"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": {
Expand Down Expand Up @@ -760,11 +764,12 @@ def test_recv_remote(self):
)
)

(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": {
Expand Down Expand Up @@ -804,11 +809,12 @@ def test_join_room_local(self):
"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": {
Expand Down

0 comments on commit 7e22afb

Please sign in to comment.