|
|
@@ -197,6 +197,23 @@ class CasHandlerTestCase(HomeserverTestCase): |
|
|
|
auth_provider_session_id=None, |
|
|
|
) |
|
|
|
|
|
|
|
@override_config({"cas_config": {"enable_registration": False}}) |
|
|
|
def test_map_cas_user_does_not_register_new_user(self) -> None: |
|
|
|
"""Ensures new users are not registered if the enabled registration flag is disabled.""" |
|
|
|
|
|
|
|
# stub out the auth handler |
|
|
|
auth_handler = self.hs.get_auth_handler() |
|
|
|
auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign] |
|
|
|
|
|
|
|
cas_response = CasResponse("test_user", {}) |
|
|
|
request = _mock_request() |
|
|
|
self.get_success( |
|
|
|
self.handler._handle_cas_response(request, cas_response, "redirect_uri", "") |
|
|
|
) |
|
|
|
|
|
|
|
# check that the auth handler was not called as expected |
|
|
|
auth_handler.complete_sso_login.assert_not_called() |
|
|
|
|
|
|
|
|
|
|
|
def _mock_request() -> Mock: |
|
|
|
"""Returns a mock which will stand in as a SynapseRequest""" |
|
|
|