mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 17:10:43 +03:00
Linting
This commit is contained in:
parent
deff332951
commit
f62000f308
4 changed files with 19 additions and 26 deletions
|
@ -48,7 +48,6 @@ class PresenceStatusRestServlet(RestServlet):
|
|||
if not self.hs.config.use_presence:
|
||||
raise AuthError(403, "Presence is disabled on this homeserver")
|
||||
|
||||
|
||||
if requester.user != user:
|
||||
allowed = yield self.presence_handler.is_visible(
|
||||
observed_user=user, observer_user=requester.user
|
||||
|
|
|
@ -58,7 +58,7 @@ class CapabilitiesRestServlet(RestServlet):
|
|||
"m.change_password": {"enabled": change_password},
|
||||
"m.presence": {
|
||||
"send_enabled": self.config.use_presence,
|
||||
"receive_enabled": self.config.use_presence
|
||||
"receive_enabled": self.config.use_presence,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,10 +69,13 @@ class PresenceTestCase(unittest.HomeserverTestCase):
|
|||
self.render(request)
|
||||
|
||||
self.assertEqual(channel.code, 403)
|
||||
self.assertEqual({
|
||||
"errcode": "M_FORBIDDEN",
|
||||
"error": "Presence is disabled on this homeserver"
|
||||
}, channel.json_body)
|
||||
self.assertEqual(
|
||||
{
|
||||
"errcode": "M_FORBIDDEN",
|
||||
"error": "Presence is disabled on this homeserver"
|
||||
},
|
||||
channel.json_body,
|
||||
)
|
||||
self.assertEqual(self.hs.presence_handler.set_state.call_count, 0)
|
||||
|
||||
def test_get_presence_disabled(self):
|
||||
|
@ -88,7 +91,10 @@ class PresenceTestCase(unittest.HomeserverTestCase):
|
|||
self.render(request)
|
||||
|
||||
self.assertEqual(channel.code, 403)
|
||||
self.assertEqual({
|
||||
"errcode": "M_FORBIDDEN",
|
||||
"error": "Presence is disabled on this homeserver"
|
||||
}, channel.json_body)
|
||||
self.assertEqual(
|
||||
{
|
||||
"errcode": "M_FORBIDDEN",
|
||||
"error": "Presence is disabled on this homeserver"
|
||||
},
|
||||
channel.json_body,
|
||||
)
|
||||
|
|
|
@ -90,14 +90,8 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
|
|||
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.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)
|
||||
|
@ -105,11 +99,5 @@ class CapabilitiesTestCase(unittest.HomeserverTestCase):
|
|||
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"],
|
||||
)
|
||||
self.assertEqual(False, capabilities["m.presence"]["send_enabled"])
|
||||
self.assertEqual(False, capabilities["m.presence"]["receive_enabled"])
|
Loading…
Reference in a new issue