mirror of
https://github.com/element-hq/synapse
synced 2024-10-01 21:32:40 +00:00
Add missing support for MSC3882 unstable r1 support
This commit is contained in:
parent
c9a0e1673a
commit
109a04313b
2 changed files with 39 additions and 2 deletions
|
@ -53,7 +53,10 @@ class LoginTokenRequestServlet(RestServlet):
|
||||||
*client_patterns(
|
*client_patterns(
|
||||||
"/login/get_token$", releases=["v1"], v1=False, unstable=False
|
"/login/get_token$", releases=["v1"], v1=False, unstable=False
|
||||||
),
|
),
|
||||||
# TODO: this is no longer needed once unstable MSC3882 does not need to be supported:
|
# TODO: these are no longer needed once unstable MSC3882 does not need to be supported:
|
||||||
|
*client_patterns(
|
||||||
|
"/org.matrix.msc3882/login/get_token$", releases=[], v1=False, unstable=True
|
||||||
|
),
|
||||||
*client_patterns(
|
*client_patterns(
|
||||||
"/org.matrix.msc3882/login/token$", releases=[], v1=False, unstable=True
|
"/org.matrix.msc3882/login/token$", releases=[], v1=False, unstable=True
|
||||||
),
|
),
|
||||||
|
|
|
@ -143,7 +143,7 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def test_unstable_support(self) -> None:
|
def test_unstable_support(self) -> None:
|
||||||
# TODO: remove support for unstable MSC3882 is no longer needed
|
# TODO: remove when unstable MSC3882 is no longer needed
|
||||||
|
|
||||||
# check feature is advertised in versions response:
|
# check feature is advertised in versions response:
|
||||||
channel = self.make_request(
|
channel = self.make_request(
|
||||||
|
@ -166,3 +166,37 @@ class LoginTokenRequestServletTestCase(unittest.HomeserverTestCase):
|
||||||
)
|
)
|
||||||
self.assertEqual(channel.code, 200)
|
self.assertEqual(channel.code, 200)
|
||||||
self.assertEqual(channel.json_body["expires_in"], 15)
|
self.assertEqual(channel.json_body["expires_in"], 15)
|
||||||
|
|
||||||
|
@override_config(
|
||||||
|
{
|
||||||
|
"login_via_existing_session": {
|
||||||
|
"enabled": True,
|
||||||
|
"require_ui_auth": False,
|
||||||
|
"token_timeout": "15s",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
def test_unstable_revision1_support(self) -> None:
|
||||||
|
# TODO: remove when unstable MSC3882 is no longer needed
|
||||||
|
|
||||||
|
# check feature is advertised in versions response:
|
||||||
|
channel = self.make_request(
|
||||||
|
"GET", "/_matrix/client/versions", {}, access_token=None
|
||||||
|
)
|
||||||
|
self.assertEqual(channel.code, 200)
|
||||||
|
self.assertEqual(
|
||||||
|
channel.json_body["unstable_features"]["org.matrix.msc3882"], True
|
||||||
|
)
|
||||||
|
|
||||||
|
self.register_user(self.user, self.password)
|
||||||
|
token = self.login(self.user, self.password)
|
||||||
|
|
||||||
|
# check feature is available via the r1 unstable endpoint and returns an expires_in_ms value in milliseconds
|
||||||
|
channel = self.make_request(
|
||||||
|
"POST",
|
||||||
|
"/_matrix/client/unstable/org.matrix.msc3882/login/get_token",
|
||||||
|
{},
|
||||||
|
access_token=token,
|
||||||
|
)
|
||||||
|
self.assertEqual(channel.code, 200)
|
||||||
|
self.assertEqual(channel.json_body["expires_in_ms"], 15000)
|
Loading…
Reference in a new issue