Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure we advertise registration as disabled when MSC3861 is enabled #17661

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tests/handlers/test_oauth_delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,16 @@ def expect_unrecognized(
channel.json_body["errcode"], Codes.UNRECOGNIZED, channel.json_body
)

def expect_forbidden(
self, method: str, path: str, content: Union[bytes, str, JsonDict] = ""
) -> None:
channel = self.make_request(method, path, content)

self.assertEqual(channel.code, 403, channel.json_body)
self.assertEqual(
channel.json_body["errcode"], Codes.FORBIDDEN, channel.json_body
)

def test_uia_endpoints(self) -> None:
"""Test that endpoints that were removed in MSC2964 are no longer available."""

Expand Down Expand Up @@ -627,7 +637,11 @@ def test_registration_endpoints_removed(self) -> None:
"GET", "/_matrix/client/v1/register/m.login.registration_token/validity"
)
# This is still available for AS registrations
# self.expect_unrecognized("POST", "/_matrix/client/v3/register")
self.expect_forbidden(
"POST",
"/_matrix/client/v3/register",
{"username": "alice", "password": "hunter2"},
)
Comment on lines +640 to +644
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test that checks that this endpoint still returns a 200 when an AS attempts to register a user?

self.expect_unrecognized("GET", "/_matrix/client/v3/register/available")
self.expect_unrecognized(
"POST", "/_matrix/client/v3/register/email/requestToken"
Expand Down
Loading