summary refs log tree commit diff
path: root/tests/rest/client/v1/test_presence.py
diff options
context:
space:
mode:
authorJonathan de Jong <jonathandejong02@gmail.com>2020-11-30 19:28:44 +0100
committerGitHub <noreply@github.com>2020-11-30 13:28:44 -0500
commitca60822b34416e524a80c5689734d870ceb6e130 (patch)
treedca86cc2cd690ac3e2f5c176432a98b4c0f1f81d /tests/rest/client/v1/test_presence.py
parentAdd `force_purge` option to delete-room admin api. (#8843) (diff)
downloadsynapse-ca60822b34416e524a80c5689734d870ceb6e130.tar.xz
Simplify the way the `HomeServer` object caches its internal attributes. (#8565)
Changes `@cache_in_self` to use underscore-prefixed attributes.
Diffstat (limited to 'tests/rest/client/v1/test_presence.py')
-rw-r--r--tests/rest/client/v1/test_presence.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/rest/client/v1/test_presence.py b/tests/rest/client/v1/test_presence.py
index b84f86d28c..5d5c24d01c 100644
--- a/tests/rest/client/v1/test_presence.py
+++ b/tests/rest/client/v1/test_presence.py
@@ -33,13 +33,16 @@ class PresenceTestCase(unittest.HomeserverTestCase):
 
     def make_homeserver(self, reactor, clock):
 
+        presence_handler = Mock()
+        presence_handler.set_state.return_value = defer.succeed(None)
+
         hs = self.setup_test_homeserver(
-            "red", http_client=None, federation_client=Mock()
+            "red",
+            http_client=None,
+            federation_client=Mock(),
+            presence_handler=presence_handler,
         )
 
-        hs.presence_handler = Mock()
-        hs.presence_handler.set_state.return_value = defer.succeed(None)
-
         return hs
 
     def test_put_presence(self):
@@ -55,7 +58,7 @@ class PresenceTestCase(unittest.HomeserverTestCase):
         )
 
         self.assertEqual(channel.code, 200)
-        self.assertEqual(self.hs.presence_handler.set_state.call_count, 1)
+        self.assertEqual(self.hs.get_presence_handler().set_state.call_count, 1)
 
     def test_put_presence_disabled(self):
         """
@@ -70,4 +73,4 @@ class PresenceTestCase(unittest.HomeserverTestCase):
         )
 
         self.assertEqual(channel.code, 200)
-        self.assertEqual(self.hs.presence_handler.set_state.call_count, 0)
+        self.assertEqual(self.hs.get_presence_handler().set_state.call_count, 0)