summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/test_presence.py10
-rw-r--r--tests/handlers/test_presencelike.py4
-rw-r--r--tests/rest/test_presence.py7
3 files changed, 15 insertions, 6 deletions
diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py
index 9efc35376a..5ae7739c2d 100644
--- a/tests/handlers/test_presence.py
+++ b/tests/handlers/test_presence.py
@@ -208,7 +208,10 @@ class PresenceStateTestCase(unittest.TestCase):
                 state={"presence": UNAVAILABLE, "status_msg": "Away"})
 
         mocked_set.assert_called_with("apple",
-            {"presence": UNAVAILABLE, "status_msg": "Away"}
+            {"presence": UNAVAILABLE,
+             "status_msg": "Away",
+             "last_active": 1000000, # MockClock
+            }
         )
         self.mock_start.assert_called_with(self.u_apple,
                 state={
@@ -1045,7 +1048,7 @@ class PresencePollingTestCase(unittest.TestCase):
             return defer.succeed(
                     {"presence": self.current_user_state[user_localpart],
                      "status_msg": None,
-                     "mtime": 123456000}
+                     "last_active": 500000}
             )
         self.datastore.get_presence_state = get_presence_state
 
@@ -1249,7 +1252,8 @@ class PresencePollingTestCase(unittest.TestCase):
                         "push": [
                             {"user_id": "@banana:test",
                              "presence": "offline",
-                             "status_msg": None},
+                             "status_msg": None,
+                             "last_active_ago": 500000},
                         ],
                     },
                 ),
diff --git a/tests/handlers/test_presencelike.py b/tests/handlers/test_presencelike.py
index 2f551f1b6b..7abf0fd5f8 100644
--- a/tests/handlers/test_presencelike.py
+++ b/tests/handlers/test_presencelike.py
@@ -151,7 +151,9 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
                 state={"presence": UNAVAILABLE, "status_msg": "Away"})
 
         mocked_set.assert_called_with("apple",
-            {"presence": UNAVAILABLE, "status_msg": "Away"}
+            {"presence": UNAVAILABLE,
+             "status_msg": "Away",
+             "last_active": 1000000}
         )
 
     @defer.inlineCallbacks
diff --git a/tests/rest/test_presence.py b/tests/rest/test_presence.py
index f355bcf712..9b0f44e637 100644
--- a/tests/rest/test_presence.py
+++ b/tests/rest/test_presence.py
@@ -21,7 +21,7 @@ from twisted.internet import defer
 from mock import Mock
 import logging
 
-from ..utils import MockHttpResource
+from ..utils import MockHttpResource, MockClock
 
 from synapse.api.constants import PresenceState
 from synapse.handlers.presence import PresenceHandler
@@ -51,6 +51,7 @@ class PresenceStateTestCase(unittest.TestCase):
         self.mock_resource = MockHttpResource(prefix=PATH_PREFIX)
 
         hs = HomeServer("test",
+            clock=MockClock(),
             db_pool=None,
             datastore=Mock(spec=[
                 "get_presence_state",
@@ -115,7 +116,9 @@ class PresenceStateTestCase(unittest.TestCase):
 
         self.assertEquals(200, code)
         mocked_set.assert_called_with("apple",
-            {"presence": UNAVAILABLE, "status_msg": "Away"}
+            {"presence": UNAVAILABLE,
+             "status_msg": "Away",
+             "last_active": 1000000}
         )