diff options
author | Will Hunt <will@half-shot.uk> | 2019-07-11 14:39:32 +0100 |
---|---|---|
committer | Will Hunt <will@half-shot.uk> | 2019-07-11 14:39:32 +0100 |
commit | cee5befbd4ed6dab17a59e242d5d6d8e033b9f84 (patch) | |
tree | 24518d219652149bb559683c1e58be8209ab759b | |
parent | Add m.presence capability (diff) | |
download | synapse-cee5befbd4ed6dab17a59e242d5d6d8e033b9f84.tar.xz |
Add test for m.presence cap
-rw-r--r-- | tests/rest/client/v2_alpha/test_capabilities.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/rest/client/v2_alpha/test_capabilities.py b/tests/rest/client/v2_alpha/test_capabilities.py index b9e01c9418..ba6e289ee2 100644 --- a/tests/rest/client/v2_alpha/test_capabilities.py +++ b/tests/rest/client/v2_alpha/test_capabilities.py @@ -79,3 +79,37 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase): self.assertEqual(channel.code, 200) self.assertFalse(capabilities["m.change_password"]["enabled"]) + + def test_get_presence(self): + self.register_user("user", "pass") + access_token = self.login("user", "pass") + + self.hs.get_config().use_presence = True + request, channel = self.make_request("GET", self.url, access_token=access_token) + self.render(request) + capabilities = channel.json_body["capabilities"] + self.assertEqual(channel.code, 200) + + self.assertEqual( + True, + capabilities["m.presence"]["send_enabled"], + ) + self.assertEqual( + True, + capabilities["m.presence"]["receive_enabled"], + ) + + self.hs.get_config().use_presence = False + request, channel = self.make_request("GET", self.url, access_token=access_token) + self.render(request) + capabilities = channel.json_body["capabilities"] + self.assertEqual(channel.code, 200) + + self.assertEqual( + False, + capabilities["m.presence"]["send_enabled"], + ) + self.assertEqual( + False, + capabilities["m.presence"]["receive_enabled"], + ) \ No newline at end of file |