Ensure that event source unit tests could cope with get_new_events_for_user() returning a Deferred
This commit is contained in:
parent
30572e28c2
commit
7e22afbc7c
tests/handlers
|
@ -632,9 +632,12 @@ class PresencePushTestCase(unittest.TestCase):
|
||||||
{"presence": ONLINE}
|
{"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_current_key(), 1)
|
||||||
self.assertEquals(
|
self.assertEquals(events,
|
||||||
self.event_source.get_new_events_for_user(self.u_apple, 0, None)[0],
|
|
||||||
[
|
[
|
||||||
{"type": "m.presence",
|
{"type": "m.presence",
|
||||||
"content": {
|
"content": {
|
||||||
|
@ -680,11 +683,12 @@ class PresencePushTestCase(unittest.TestCase):
|
||||||
"state": OFFLINE},
|
"state": OFFLINE},
|
||||||
], presence)
|
], 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_current_key(), 2)
|
||||||
self.assertEquals(
|
self.assertEquals(events,
|
||||||
self.event_source.get_new_events_for_user(
|
|
||||||
self.u_banana, 1, None
|
|
||||||
)[0],
|
|
||||||
[
|
[
|
||||||
{"type": "m.presence",
|
{"type": "m.presence",
|
||||||
"content": {
|
"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_current_key(), 1)
|
||||||
self.assertEquals(
|
self.assertEquals(events,
|
||||||
self.event_source.get_new_events_for_user(
|
|
||||||
self.u_apple, 0, None
|
|
||||||
)[0],
|
|
||||||
[
|
[
|
||||||
{"type": "m.presence",
|
{"type": "m.presence",
|
||||||
"content": {
|
"content": {
|
||||||
|
@ -804,11 +809,12 @@ class PresencePushTestCase(unittest.TestCase):
|
||||||
"a-room"
|
"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_current_key(), 1)
|
||||||
self.assertEquals(
|
self.assertEquals(events,
|
||||||
self.event_source.get_new_events_for_user(
|
|
||||||
self.u_apple, 0, None
|
|
||||||
)[0],
|
|
||||||
[
|
[
|
||||||
{"type": "m.presence",
|
{"type": "m.presence",
|
||||||
"content": {
|
"content": {
|
||||||
|
|
Loading…
Reference in New Issue