summary refs log tree commit diff
path: root/tests/rest/client
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-03-02 17:24:52 +0000
committerGitHub <noreply@github.com>2022-03-02 17:24:52 +0000
commit106959b3cf1a59ab5469db639223b6a5b84fb7d7 (patch)
tree4d56733cf7e6e2b4f3937c4b70dfa8d05f89f6bd /tests/rest/client
parentAdd type hints to `tests/rest/client` (#12108) (diff)
downloadsynapse-106959b3cf1a59ab5469db639223b6a5b84fb7d7.tar.xz
Remove unused mocks from `test_typing` (#12136)
* Remove unused mocks from `test_typing`

It's not clear what these do. `get_user_by_access_token` has the wrong
signature, including the return type. Tests all pass without these. I
think we should nuke them.

* Changelog

* Fixup imports
Diffstat (limited to 'tests/rest/client')
-rw-r--r--tests/rest/client/test_typing.py32
1 files changed, 1 insertions, 31 deletions
diff --git a/tests/rest/client/test_typing.py b/tests/rest/client/test_typing.py
index 43be711a64..d6da510773 100644
--- a/tests/rest/client/test_typing.py
+++ b/tests/rest/client/test_typing.py
@@ -14,14 +14,11 @@
 # limitations under the License.
 
 """Tests REST events for /rooms paths."""
-from typing import Any
-from unittest.mock import Mock
 
 from twisted.test.proto_helpers import MemoryReactor
 
 from synapse.rest.client import room
 from synapse.server import HomeServer
-from synapse.storage.databases.main.registration import TokenLookupResult
 from synapse.types import UserID
 from synapse.util import Clock
 
@@ -39,35 +36,8 @@ class RoomTypingTestCase(unittest.HomeserverTestCase):
     servlets = [room.register_servlets]
 
     def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:
-
-        hs = self.setup_test_homeserver(
-            "red",
-            federation_http_client=None,
-            federation_client=Mock(),
-        )
-
+        hs = self.setup_test_homeserver("red")
         self.event_source = hs.get_event_sources().sources.typing
-
-        hs.get_federation_handler = Mock()  # type: ignore[assignment]
-
-        async def get_user_by_access_token(
-            token: str,
-            rights: str = "access",
-            allow_expired: bool = False,
-        ) -> TokenLookupResult:
-            return TokenLookupResult(
-                user_id=self.user_id,
-                is_guest=False,
-                token_id=1,
-            )
-
-        hs.get_auth().get_user_by_access_token = get_user_by_access_token  # type: ignore[assignment]
-
-        async def _insert_client_ip(*args: Any, **kwargs: Any) -> None:
-            return None
-
-        hs.get_datastores().main.insert_client_ip = _insert_client_ip  # type: ignore[assignment]
-
         return hs
 
     def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None: