diff --git a/tests/rest/admin/test_user.py b/tests/rest/admin/test_user.py
index 339a41c7e1..2f6bd0d74f 100644
--- a/tests/rest/admin/test_user.py
+++ b/tests/rest/admin/test_user.py
@@ -71,8 +71,8 @@ class UserRegisterTestCase(unittest.HomeserverTestCase):
self.hs.config.registration.registration_shared_secret = "shared"
- self.hs.get_media_repository = Mock() # type: ignore[assignment]
- self.hs.get_deactivate_account_handler = Mock() # type: ignore[assignment]
+ self.hs.get_media_repository = Mock() # type: ignore[method-assign]
+ self.hs.get_deactivate_account_handler = Mock() # type: ignore[method-assign]
return self.hs
diff --git a/tests/rest/admin/test_username_available.py b/tests/rest/admin/test_username_available.py
index 6c04e6c56c..4c69d224b8 100644
--- a/tests/rest/admin/test_username_available.py
+++ b/tests/rest/admin/test_username_available.py
@@ -50,7 +50,7 @@ class UsernameAvailableTestCase(unittest.HomeserverTestCase):
)
handler = self.hs.get_registration_handler()
- handler.check_username = check_username # type: ignore[assignment]
+ handler.check_username = check_username # type: ignore[method-assign]
def test_username_available(self) -> None:
"""
diff --git a/tests/rest/client/test_account.py b/tests/rest/client/test_account.py
index ac19f3c6da..e9f495e206 100644
--- a/tests/rest/client/test_account.py
+++ b/tests/rest/client/test_account.py
@@ -1346,7 +1346,7 @@ class AccountStatusTestCase(unittest.HomeserverTestCase):
return {}
# Register a mock that will return the expected result depending on the remote.
- self.hs.get_federation_http_client().post_json = Mock(side_effect=post_json) # type: ignore[assignment]
+ self.hs.get_federation_http_client().post_json = Mock(side_effect=post_json) # type: ignore[method-assign]
# Check that we've got the correct response from the client-side endpoint.
self._test_status(
diff --git a/tests/rest/client/test_events.py b/tests/rest/client/test_events.py
index 54df2a252c..141e0f57a3 100644
--- a/tests/rest/client/test_events.py
+++ b/tests/rest/client/test_events.py
@@ -45,7 +45,7 @@ class EventStreamPermissionsTestCase(unittest.HomeserverTestCase):
hs = self.setup_test_homeserver(config=config)
- hs.get_federation_handler = Mock() # type: ignore[assignment]
+ hs.get_federation_handler = Mock() # type: ignore[method-assign]
return hs
diff --git a/tests/rest/client/test_filter.py b/tests/rest/client/test_filter.py
index a2d5d340be..90a8df147c 100644
--- a/tests/rest/client/test_filter.py
+++ b/tests/rest/client/test_filter.py
@@ -65,14 +65,14 @@ class FilterTestCase(unittest.HomeserverTestCase):
def test_add_filter_non_local_user(self) -> None:
_is_mine = self.hs.is_mine
- self.hs.is_mine = lambda target_user: False # type: ignore[assignment]
+ self.hs.is_mine = lambda target_user: False # type: ignore[method-assign]
channel = self.make_request(
"POST",
"/_matrix/client/r0/user/%s/filter" % (self.user_id),
self.EXAMPLE_FILTER_JSON,
)
- self.hs.is_mine = _is_mine # type: ignore[assignment]
+ self.hs.is_mine = _is_mine # type: ignore[method-assign]
self.assertEqual(channel.code, 403)
self.assertEqual(channel.json_body["errcode"], Codes.FORBIDDEN)
diff --git a/tests/rest/client/test_rooms.py b/tests/rest/client/test_rooms.py
index 53182459e4..47c1d38ad7 100644
--- a/tests/rest/client/test_rooms.py
+++ b/tests/rest/client/test_rooms.py
@@ -68,7 +68,7 @@ class RoomBase(unittest.HomeserverTestCase):
"red",
)
- self.hs.get_federation_handler = Mock() # type: ignore[assignment]
+ self.hs.get_federation_handler = Mock() # type: ignore[method-assign]
self.hs.get_federation_handler.return_value.maybe_backfill = AsyncMock(
return_value=None
)
@@ -76,7 +76,7 @@ class RoomBase(unittest.HomeserverTestCase):
async def _insert_client_ip(*args: Any, **kwargs: Any) -> None:
return None
- self.hs.get_datastores().main.insert_client_ip = _insert_client_ip # type: ignore[assignment]
+ self.hs.get_datastores().main.insert_client_ip = _insert_client_ip # type: ignore[method-assign]
return self.hs
@@ -3413,8 +3413,8 @@ class ThreepidInviteTestCase(unittest.HomeserverTestCase):
# a remote IS. We keep the mock for make_and_store_3pid_invite around so we
# can check its call_count later on during the test.
make_invite_mock = AsyncMock(return_value=(Mock(event_id="abc"), 0))
- self.hs.get_room_member_handler()._make_and_store_3pid_invite = make_invite_mock # type: ignore[assignment]
- self.hs.get_identity_handler().lookup_3pid = AsyncMock( # type: ignore[assignment]
+ self.hs.get_room_member_handler()._make_and_store_3pid_invite = make_invite_mock # type: ignore[method-assign]
+ self.hs.get_identity_handler().lookup_3pid = AsyncMock( # type: ignore[method-assign]
return_value=None,
)
@@ -3477,8 +3477,8 @@ class ThreepidInviteTestCase(unittest.HomeserverTestCase):
# a remote IS. We keep the mock for make_and_store_3pid_invite around so we
# can check its call_count later on during the test.
make_invite_mock = AsyncMock(return_value=(Mock(event_id="abc"), 0))
- self.hs.get_room_member_handler()._make_and_store_3pid_invite = make_invite_mock # type: ignore[assignment]
- self.hs.get_identity_handler().lookup_3pid = AsyncMock( # type: ignore[assignment]
+ self.hs.get_room_member_handler()._make_and_store_3pid_invite = make_invite_mock # type: ignore[method-assign]
+ self.hs.get_identity_handler().lookup_3pid = AsyncMock( # type: ignore[method-assign]
return_value=None,
)
diff --git a/tests/rest/client/test_shadow_banned.py b/tests/rest/client/test_shadow_banned.py
index 8d2cdf8751..9aecf88e41 100644
--- a/tests/rest/client/test_shadow_banned.py
+++ b/tests/rest/client/test_shadow_banned.py
@@ -84,7 +84,7 @@ class RoomTestCase(_ShadowBannedBase):
def test_invite_3pid(self) -> None:
"""Ensure that a 3PID invite does not attempt to contact the identity server."""
identity_handler = self.hs.get_identity_handler()
- identity_handler.lookup_3pid = Mock( # type: ignore[assignment]
+ identity_handler.lookup_3pid = Mock( # type: ignore[method-assign]
side_effect=AssertionError("This should not get called")
)
diff --git a/tests/rest/client/test_third_party_rules.py b/tests/rest/client/test_third_party_rules.py
index da37fcb045..57eb713b15 100644
--- a/tests/rest/client/test_third_party_rules.py
+++ b/tests/rest/client/test_third_party_rules.py
@@ -117,7 +117,7 @@ class ThirdPartyRulesTestCase(unittest.FederatingHomeserverTestCase):
async def _check_event_auth(origin: Any, event: Any, context: Any) -> None:
pass
- hs.get_federation_event_handler()._check_event_auth = _check_event_auth # type: ignore[assignment]
+ hs.get_federation_event_handler()._check_event_auth = _check_event_auth # type: ignore[method-assign]
return hs
|