diff options
author | Hugh Nimmo-Smith <hughns@users.noreply.github.com> | 2023-06-01 13:52:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 08:52:51 -0400 |
commit | d1693f03626391097b59ea9568cd8a869ed89569 (patch) | |
tree | a88e675174b8ba030b231f7661e59d44e61e0654 /tests/rest/client/test_login.py | |
parent | Add Synapse version deploy annotations to Grafana dashboard (#15674) (diff) | |
download | synapse-d1693f03626391097b59ea9568cd8a869ed89569.tar.xz |
Implement stable support for MSC3882 to allow an existing device/session to generate a login token for use on a new device/session (#15388)
Implements stable support for MSC3882; this involves updating Synapse's support to match the MSC / the spec says. Continue to support the unstable version to allow clients to transition.
Diffstat (limited to 'tests/rest/client/test_login.py')
-rw-r--r-- | tests/rest/client/test_login.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/rest/client/test_login.py b/tests/rest/client/test_login.py index dc32982e22..f3c3bc69a9 100644 --- a/tests/rest/client/test_login.py +++ b/tests/rest/client/test_login.py @@ -446,6 +446,29 @@ class LoginRestServletTestCase(unittest.HomeserverTestCase): ApprovalNoticeMedium.NONE, channel.json_body["approval_notice_medium"] ) + def test_get_login_flows_with_login_via_existing_disabled(self) -> None: + """GET /login should return m.login.token without get_login_token""" + channel = self.make_request("GET", "/_matrix/client/r0/login") + self.assertEqual(channel.code, 200, channel.result) + + flows = {flow["type"]: flow for flow in channel.json_body["flows"]} + self.assertNotIn("m.login.token", flows) + + @override_config({"login_via_existing_session": {"enabled": True}}) + def test_get_login_flows_with_login_via_existing_enabled(self) -> None: + """GET /login should return m.login.token with get_login_token true""" + channel = self.make_request("GET", "/_matrix/client/r0/login") + self.assertEqual(channel.code, 200, channel.result) + + self.assertCountEqual( + channel.json_body["flows"], + [ + {"type": "m.login.token", "get_login_token": True}, + {"type": "m.login.password"}, + {"type": "m.login.application_service"}, + ], + ) + @skip_unless(has_saml2 and HAS_OIDC, "Requires SAML2 and OIDC") class MultiSSOTestCase(unittest.HomeserverTestCase): |