summary refs log tree commit diff
path: root/tests/rest/client/test_presence.py
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2022-02-24 19:56:38 +0100
committerGitHub <noreply@github.com>2022-02-24 13:56:38 -0500
commit54e74cc15f30585f5874780437614c0df6f639d9 (patch)
tree8b8465bbddaaf444544a315932e2e952e9638d21 /tests/rest/client/test_presence.py
parentAdd support for MSC3202: sending one-time key counts and fallback key usage s... (diff)
downloadsynapse-54e74cc15f30585f5874780437614c0df6f639d9.tar.xz
Add type hints to `tests/rest/client` (#12072)
Diffstat (limited to 'tests/rest/client/test_presence.py')
-rw-r--r--tests/rest/client/test_presence.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/rest/client/test_presence.py b/tests/rest/client/test_presence.py
index 56fe1a3d01..0abe378fe4 100644
--- a/tests/rest/client/test_presence.py
+++ b/tests/rest/client/test_presence.py
@@ -11,14 +11,17 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
+from http import HTTPStatus
 from unittest.mock import Mock
 
 from twisted.internet import defer
+from twisted.test.proto_helpers import MemoryReactor
 
 from synapse.handlers.presence import PresenceHandler
 from synapse.rest.client import presence
+from synapse.server import HomeServer
 from synapse.types import UserID
+from synapse.util import Clock
 
 from tests import unittest
 
@@ -31,7 +34,7 @@ class PresenceTestCase(unittest.HomeserverTestCase):
     user = UserID.from_string(user_id)
     servlets = [presence.register_servlets]
 
-    def make_homeserver(self, reactor, clock):
+    def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
 
         presence_handler = Mock(spec=PresenceHandler)
         presence_handler.set_state.return_value = defer.succeed(None)
@@ -45,7 +48,7 @@ class PresenceTestCase(unittest.HomeserverTestCase):
 
         return hs
 
-    def test_put_presence(self):
+    def test_put_presence(self) -> None:
         """
         PUT to the status endpoint with use_presence enabled will call
         set_state on the presence handler.
@@ -57,11 +60,11 @@ class PresenceTestCase(unittest.HomeserverTestCase):
             "PUT", "/presence/%s/status" % (self.user_id,), body
         )
 
-        self.assertEqual(channel.code, 200)
+        self.assertEqual(channel.code, HTTPStatus.OK)
         self.assertEqual(self.hs.get_presence_handler().set_state.call_count, 1)
 
     @unittest.override_config({"use_presence": False})
-    def test_put_presence_disabled(self):
+    def test_put_presence_disabled(self) -> None:
         """
         PUT to the status endpoint with use_presence disabled will NOT call
         set_state on the presence handler.
@@ -72,5 +75,5 @@ class PresenceTestCase(unittest.HomeserverTestCase):
             "PUT", "/presence/%s/status" % (self.user_id,), body
         )
 
-        self.assertEqual(channel.code, 200)
+        self.assertEqual(channel.code, HTTPStatus.OK)
         self.assertEqual(self.hs.get_presence_handler().set_state.call_count, 0)