summary refs log tree commit diff
path: root/tests/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'tests/handlers')
-rw-r--r--tests/handlers/test_auth.py6
-rw-r--r--tests/handlers/test_cas.py40
-rw-r--r--tests/handlers/test_oidc.py135
-rw-r--r--tests/handlers/test_room_summary.py94
-rw-r--r--tests/handlers/test_saml.py40
5 files changed, 62 insertions, 253 deletions
diff --git a/tests/handlers/test_auth.py b/tests/handlers/test_auth.py
index 03b8b8615c..72e176da75 100644
--- a/tests/handlers/test_auth.py
+++ b/tests/handlers/test_auth.py
@@ -71,7 +71,7 @@ class AuthTestCase(unittest.HomeserverTestCase):
 
     def test_short_term_login_token_gives_user_id(self):
         token = self.macaroon_generator.generate_short_term_login_token(
-            self.user1, "", duration_in_ms=5000
+            self.user1, "", 5000
         )
         res = self.get_success(self.auth_handler.validate_short_term_login_token(token))
         self.assertEqual(self.user1, res.user_id)
@@ -94,7 +94,7 @@ class AuthTestCase(unittest.HomeserverTestCase):
 
     def test_short_term_login_token_cannot_replace_user_id(self):
         token = self.macaroon_generator.generate_short_term_login_token(
-            self.user1, "", duration_in_ms=5000
+            self.user1, "", 5000
         )
         macaroon = pymacaroons.Macaroon.deserialize(token)
 
@@ -213,6 +213,6 @@ class AuthTestCase(unittest.HomeserverTestCase):
 
     def _get_macaroon(self):
         token = self.macaroon_generator.generate_short_term_login_token(
-            self.user1, "", duration_in_ms=5000
+            self.user1, "", 5000
         )
         return pymacaroons.Macaroon.deserialize(token)
diff --git a/tests/handlers/test_cas.py b/tests/handlers/test_cas.py
index 8705ff8943..b625995d12 100644
--- a/tests/handlers/test_cas.py
+++ b/tests/handlers/test_cas.py
@@ -66,13 +66,7 @@ class CasHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "cas",
-            request,
-            "redirect_uri",
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user:test", "cas", request, "redirect_uri", None, new_user=True
         )
 
     def test_map_cas_user_to_existing_user(self):
@@ -95,13 +89,7 @@ class CasHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "cas",
-            request,
-            "redirect_uri",
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            "@test_user:test", "cas", request, "redirect_uri", None, new_user=False
         )
 
         # Subsequent calls should map to the same mxid.
@@ -110,13 +98,7 @@ class CasHandlerTestCase(HomeserverTestCase):
             self.handler._handle_cas_response(request, cas_response, "redirect_uri", "")
         )
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "cas",
-            request,
-            "redirect_uri",
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            "@test_user:test", "cas", request, "redirect_uri", None, new_user=False
         )
 
     def test_map_cas_user_to_invalid_localpart(self):
@@ -134,13 +116,7 @@ class CasHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@f=c3=b6=c3=b6:test",
-            "cas",
-            request,
-            "redirect_uri",
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@f=c3=b6=c3=b6:test", "cas", request, "redirect_uri", None, new_user=True
         )
 
     @override_config(
@@ -184,13 +160,7 @@ class CasHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "cas",
-            request,
-            "redirect_uri",
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user:test", "cas", request, "redirect_uri", None, new_user=True
         )
 
 
diff --git a/tests/handlers/test_oidc.py b/tests/handlers/test_oidc.py
index cfe3de5266..a25c89bd5b 100644
--- a/tests/handlers/test_oidc.py
+++ b/tests/handlers/test_oidc.py
@@ -252,6 +252,13 @@ class OidcHandlerTestCase(HomeserverTestCase):
         with patch.object(self.provider, "load_metadata", patched_load_metadata):
             self.get_failure(self.provider.load_jwks(force=True), RuntimeError)
 
+        # Return empty key set if JWKS are not used
+        self.provider._scopes = []  # not asking the openid scope
+        self.http_client.get_json.reset_mock()
+        jwks = self.get_success(self.provider.load_jwks(force=True))
+        self.http_client.get_json.assert_not_called()
+        self.assertEqual(jwks, {"keys": []})
+
     @override_config({"oidc_config": DEFAULT_CONFIG})
     def test_validate_config(self):
         """Provider metadatas are extensively validated."""
@@ -448,13 +455,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
         self.get_success(self.handler.handle_oidc_callback(request))
 
         auth_handler.complete_sso_login.assert_called_once_with(
-            expected_user_id,
-            "oidc",
-            request,
-            client_redirect_url,
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            expected_user_id, "oidc", request, client_redirect_url, None, new_user=True
         )
         self.provider._exchange_code.assert_called_once_with(code)
         self.provider._parse_id_token.assert_called_once_with(token, nonce=nonce)
@@ -481,58 +482,17 @@ class OidcHandlerTestCase(HomeserverTestCase):
         self.provider._fetch_userinfo.reset_mock()
 
         # With userinfo fetching
-        self.provider._user_profile_method = "userinfo_endpoint"
-        token = {
-            "type": "bearer",
-            "access_token": "access_token",
-        }
-        self.provider._exchange_code = simple_async_mock(return_value=token)
+        self.provider._scopes = []  # do not ask the "openid" scope
         self.get_success(self.handler.handle_oidc_callback(request))
 
         auth_handler.complete_sso_login.assert_called_once_with(
-            expected_user_id,
-            "oidc",
-            request,
-            client_redirect_url,
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            expected_user_id, "oidc", request, client_redirect_url, None, new_user=False
         )
         self.provider._exchange_code.assert_called_once_with(code)
         self.provider._parse_id_token.assert_not_called()
         self.provider._fetch_userinfo.assert_called_once_with(token)
         self.render_error.assert_not_called()
 
-        # With an ID token, userinfo fetching and sid in the ID token
-        self.provider._user_profile_method = "userinfo_endpoint"
-        token = {
-            "type": "bearer",
-            "access_token": "access_token",
-            "id_token": "id_token",
-        }
-        id_token = {
-            "sid": "abcdefgh",
-        }
-        self.provider._parse_id_token = simple_async_mock(return_value=id_token)
-        self.provider._exchange_code = simple_async_mock(return_value=token)
-        auth_handler.complete_sso_login.reset_mock()
-        self.provider._fetch_userinfo.reset_mock()
-        self.get_success(self.handler.handle_oidc_callback(request))
-
-        auth_handler.complete_sso_login.assert_called_once_with(
-            expected_user_id,
-            "oidc",
-            request,
-            client_redirect_url,
-            None,
-            new_user=False,
-            auth_provider_session_id=id_token["sid"],
-        )
-        self.provider._exchange_code.assert_called_once_with(code)
-        self.provider._parse_id_token.assert_called_once_with(token, nonce=nonce)
-        self.provider._fetch_userinfo.assert_called_once_with(token)
-        self.render_error.assert_not_called()
-
         # Handle userinfo fetching error
         self.provider._fetch_userinfo = simple_async_mock(raises=Exception())
         self.get_success(self.handler.handle_oidc_callback(request))
@@ -816,7 +776,6 @@ class OidcHandlerTestCase(HomeserverTestCase):
             client_redirect_url,
             {"phone": "1234567"},
             new_user=True,
-            auth_provider_session_id=None,
         )
 
     @override_config({"oidc_config": DEFAULT_CONFIG})
@@ -831,13 +790,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
         }
         self.get_success(_make_callback_with_userinfo(self.hs, userinfo))
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user:test", "oidc", ANY, ANY, None, new_user=True
         )
         auth_handler.complete_sso_login.reset_mock()
 
@@ -848,13 +801,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
         }
         self.get_success(_make_callback_with_userinfo(self.hs, userinfo))
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user_2:test",
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user_2:test", "oidc", ANY, ANY, None, new_user=True
         )
         auth_handler.complete_sso_login.reset_mock()
 
@@ -891,26 +838,14 @@ class OidcHandlerTestCase(HomeserverTestCase):
         }
         self.get_success(_make_callback_with_userinfo(self.hs, userinfo))
         auth_handler.complete_sso_login.assert_called_once_with(
-            user.to_string(),
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            user.to_string(), "oidc", ANY, ANY, None, new_user=False
         )
         auth_handler.complete_sso_login.reset_mock()
 
         # Subsequent calls should map to the same mxid.
         self.get_success(_make_callback_with_userinfo(self.hs, userinfo))
         auth_handler.complete_sso_login.assert_called_once_with(
-            user.to_string(),
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            user.to_string(), "oidc", ANY, ANY, None, new_user=False
         )
         auth_handler.complete_sso_login.reset_mock()
 
@@ -925,13 +860,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
         }
         self.get_success(_make_callback_with_userinfo(self.hs, userinfo))
         auth_handler.complete_sso_login.assert_called_once_with(
-            user.to_string(),
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            user.to_string(), "oidc", ANY, ANY, None, new_user=False
         )
         auth_handler.complete_sso_login.reset_mock()
 
@@ -967,13 +896,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
 
         self.get_success(_make_callback_with_userinfo(self.hs, userinfo))
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@TEST_USER_2:test",
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            "@TEST_USER_2:test", "oidc", ANY, ANY, None, new_user=False
         )
 
     @override_config({"oidc_config": DEFAULT_CONFIG})
@@ -1011,13 +934,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
 
         # test_user is already taken, so test_user1 gets registered instead.
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user1:test",
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user1:test", "oidc", ANY, ANY, None, new_user=True
         )
         auth_handler.complete_sso_login.reset_mock()
 
@@ -1101,13 +1018,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@tester:test",
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@tester:test", "oidc", ANY, ANY, None, new_user=True
         )
 
     @override_config(
@@ -1132,13 +1043,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@tester:test",
-            "oidc",
-            ANY,
-            ANY,
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@tester:test", "oidc", ANY, ANY, None, new_user=True
         )
 
     @override_config(
@@ -1251,7 +1156,7 @@ async def _make_callback_with_userinfo(
 
     handler = hs.get_oidc_handler()
     provider = handler._providers["oidc"]
-    provider._exchange_code = simple_async_mock(return_value={"id_token": ""})
+    provider._exchange_code = simple_async_mock(return_value={})
     provider._parse_id_token = simple_async_mock(return_value=userinfo)
     provider._fetch_userinfo = simple_async_mock(return_value=userinfo)
 
diff --git a/tests/handlers/test_room_summary.py b/tests/handlers/test_room_summary.py
index e5a6a6c747..7b95844b55 100644
--- a/tests/handlers/test_room_summary.py
+++ b/tests/handlers/test_room_summary.py
@@ -32,7 +32,7 @@ from synapse.handlers.room_summary import _child_events_comparison_key, _RoomEnt
 from synapse.rest import admin
 from synapse.rest.client import login, room
 from synapse.server import HomeServer
-from synapse.types import JsonDict, UserID, create_requester
+from synapse.types import JsonDict, UserID
 
 from tests import unittest
 
@@ -249,7 +249,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         self._assert_rooms(result, expected)
 
         result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
         self._assert_hierarchy(result, expected)
 
@@ -263,9 +263,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         expected = [(self.space, [self.room]), (self.room, ())]
         self._assert_rooms(result, expected)
 
-        result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space)
-        )
+        result = self.get_success(self.handler.get_room_hierarchy(user2, self.space))
         self._assert_hierarchy(result, expected)
 
         # If the space is made invite-only, it should no longer be viewable.
@@ -276,10 +274,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
             tok=self.token,
         )
         self.get_failure(self.handler.get_space_summary(user2, self.space), AuthError)
-        self.get_failure(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space),
-            AuthError,
-        )
+        self.get_failure(self.handler.get_room_hierarchy(user2, self.space), AuthError)
 
         # If the space is made world-readable it should return a result.
         self.helper.send_state(
@@ -291,9 +286,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         result = self.get_success(self.handler.get_space_summary(user2, self.space))
         self._assert_rooms(result, expected)
 
-        result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space)
-        )
+        result = self.get_success(self.handler.get_room_hierarchy(user2, self.space))
         self._assert_hierarchy(result, expected)
 
         # Make it not world-readable again and confirm it results in an error.
@@ -304,10 +297,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
             tok=self.token,
         )
         self.get_failure(self.handler.get_space_summary(user2, self.space), AuthError)
-        self.get_failure(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space),
-            AuthError,
-        )
+        self.get_failure(self.handler.get_room_hierarchy(user2, self.space), AuthError)
 
         # Join the space and results should be returned.
         self.helper.invite(self.space, targ=user2, tok=self.token)
@@ -315,9 +305,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         result = self.get_success(self.handler.get_space_summary(user2, self.space))
         self._assert_rooms(result, expected)
 
-        result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space)
-        )
+        result = self.get_success(self.handler.get_room_hierarchy(user2, self.space))
         self._assert_hierarchy(result, expected)
 
         # Attempting to view an unknown room returns the same error.
@@ -326,9 +314,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
             AuthError,
         )
         self.get_failure(
-            self.handler.get_room_hierarchy(
-                create_requester(user2), "#not-a-space:" + self.hs.hostname
-            ),
+            self.handler.get_room_hierarchy(user2, "#not-a-space:" + self.hs.hostname),
             AuthError,
         )
 
@@ -336,10 +322,10 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         """In-flight room hierarchy requests are deduplicated."""
         # Run two `get_room_hierarchy` calls up until they block.
         deferred1 = ensureDeferred(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
         deferred2 = ensureDeferred(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
 
         # Complete the two calls.
@@ -354,7 +340,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
 
         # A subsequent `get_room_hierarchy` call should not reuse the result.
         result3 = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
         self._assert_hierarchy(result3, expected)
         self.assertIsNot(result1, result3)
@@ -373,11 +359,9 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
 
         # Run two `get_room_hierarchy` calls for different users up until they block.
         deferred1 = ensureDeferred(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
-        )
-        deferred2 = ensureDeferred(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
+        deferred2 = ensureDeferred(self.handler.get_room_hierarchy(user2, self.space))
 
         # Complete the two calls.
         result1 = self.get_success(deferred1)
@@ -481,9 +465,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         ]
         self._assert_rooms(result, expected)
 
-        result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(user2), self.space)
-        )
+        result = self.get_success(self.handler.get_room_hierarchy(user2, self.space))
         self._assert_hierarchy(result, expected)
 
     def test_complex_space(self):
@@ -525,7 +507,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         self._assert_rooms(result, expected)
 
         result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
         self._assert_hierarchy(result, expected)
 
@@ -540,9 +522,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         room_ids.append(self.room)
 
         result = self.get_success(
-            self.handler.get_room_hierarchy(
-                create_requester(self.user), self.space, limit=7
-            )
+            self.handler.get_room_hierarchy(self.user, self.space, limit=7)
         )
         # The result should have the space and all of the links, plus some of the
         # rooms and a pagination token.
@@ -554,10 +534,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         # Check the next page.
         result = self.get_success(
             self.handler.get_room_hierarchy(
-                create_requester(self.user),
-                self.space,
-                limit=5,
-                from_token=result["next_batch"],
+                self.user, self.space, limit=5, from_token=result["next_batch"]
             )
         )
         # The result should have the space and the room in it, along with a link
@@ -577,22 +554,20 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         room_ids.append(self.room)
 
         result = self.get_success(
-            self.handler.get_room_hierarchy(
-                create_requester(self.user), self.space, limit=7
-            )
+            self.handler.get_room_hierarchy(self.user, self.space, limit=7)
         )
         self.assertIn("next_batch", result)
 
         # Changing the room ID, suggested-only, or max-depth causes an error.
         self.get_failure(
             self.handler.get_room_hierarchy(
-                create_requester(self.user), self.room, from_token=result["next_batch"]
+                self.user, self.room, from_token=result["next_batch"]
             ),
             SynapseError,
         )
         self.get_failure(
             self.handler.get_room_hierarchy(
-                create_requester(self.user),
+                self.user,
                 self.space,
                 suggested_only=True,
                 from_token=result["next_batch"],
@@ -601,19 +576,14 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         )
         self.get_failure(
             self.handler.get_room_hierarchy(
-                create_requester(self.user),
-                self.space,
-                max_depth=0,
-                from_token=result["next_batch"],
+                self.user, self.space, max_depth=0, from_token=result["next_batch"]
             ),
             SynapseError,
         )
 
         # An invalid token is ignored.
         self.get_failure(
-            self.handler.get_room_hierarchy(
-                create_requester(self.user), self.space, from_token="foo"
-            ),
+            self.handler.get_room_hierarchy(self.user, self.space, from_token="foo"),
             SynapseError,
         )
 
@@ -639,18 +609,14 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
 
         # Test just the space itself.
         result = self.get_success(
-            self.handler.get_room_hierarchy(
-                create_requester(self.user), self.space, max_depth=0
-            )
+            self.handler.get_room_hierarchy(self.user, self.space, max_depth=0)
         )
         expected: List[Tuple[str, Iterable[str]]] = [(spaces[0], [rooms[0], spaces[1]])]
         self._assert_hierarchy(result, expected)
 
         # A single additional layer.
         result = self.get_success(
-            self.handler.get_room_hierarchy(
-                create_requester(self.user), self.space, max_depth=1
-            )
+            self.handler.get_room_hierarchy(self.user, self.space, max_depth=1)
         )
         expected += [
             (rooms[0], ()),
@@ -660,9 +626,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
 
         # A few layers.
         result = self.get_success(
-            self.handler.get_room_hierarchy(
-                create_requester(self.user), self.space, max_depth=3
-            )
+            self.handler.get_room_hierarchy(self.user, self.space, max_depth=3)
         )
         expected += [
             (rooms[1], ()),
@@ -693,7 +657,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         self._assert_rooms(result, expected)
 
         result = self.get_success(
-            self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+            self.handler.get_room_hierarchy(self.user, self.space)
         )
         self._assert_hierarchy(result, expected)
 
@@ -775,7 +739,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
             new=summarize_remote_room_hierarchy,
         ):
             result = self.get_success(
-                self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+                self.handler.get_room_hierarchy(self.user, self.space)
             )
         self._assert_hierarchy(result, expected)
 
@@ -942,7 +906,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
             new=summarize_remote_room_hierarchy,
         ):
             result = self.get_success(
-                self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+                self.handler.get_room_hierarchy(self.user, self.space)
             )
         self._assert_hierarchy(result, expected)
 
@@ -1000,7 +964,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
             new=summarize_remote_room_hierarchy,
         ):
             result = self.get_success(
-                self.handler.get_room_hierarchy(create_requester(self.user), self.space)
+                self.handler.get_room_hierarchy(self.user, self.space)
             )
         self._assert_hierarchy(result, expected)
 
diff --git a/tests/handlers/test_saml.py b/tests/handlers/test_saml.py
index 50551aa6e3..8cfc184fef 100644
--- a/tests/handlers/test_saml.py
+++ b/tests/handlers/test_saml.py
@@ -130,13 +130,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "saml",
-            request,
-            "redirect_uri",
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user:test", "saml", request, "redirect_uri", None, new_user=True
         )
 
     @override_config({"saml2_config": {"grandfathered_mxid_source_attribute": "mxid"}})
@@ -162,13 +156,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "saml",
-            request,
-            "",
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            "@test_user:test", "saml", request, "", None, new_user=False
         )
 
         # Subsequent calls should map to the same mxid.
@@ -177,13 +165,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
             self.handler._handle_authn_response(request, saml_response, "")
         )
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "saml",
-            request,
-            "",
-            None,
-            new_user=False,
-            auth_provider_session_id=None,
+            "@test_user:test", "saml", request, "", None, new_user=False
         )
 
     def test_map_saml_response_to_invalid_localpart(self):
@@ -231,13 +213,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
 
         # test_user is already taken, so test_user1 gets registered instead.
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user1:test",
-            "saml",
-            request,
-            "",
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user1:test", "saml", request, "", None, new_user=True
         )
         auth_handler.complete_sso_login.reset_mock()
 
@@ -333,13 +309,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
 
         # check that the auth handler got called as expected
         auth_handler.complete_sso_login.assert_called_once_with(
-            "@test_user:test",
-            "saml",
-            request,
-            "redirect_uri",
-            None,
-            new_user=True,
-            auth_provider_session_id=None,
+            "@test_user:test", "saml", request, "redirect_uri", None, new_user=True
         )