diff --git a/tests/appservice/test_api.py b/tests/appservice/test_api.py
index 3c635e3dcb..75fb5fae6b 100644
--- a/tests/appservice/test_api.py
+++ b/tests/appservice/test_api.py
@@ -96,7 +96,7 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
)
# We assign to a method, which mypy doesn't like.
- self.api.get_json = Mock(side_effect=get_json) # type: ignore[assignment]
+ self.api.get_json = Mock(side_effect=get_json) # type: ignore[method-assign]
result = self.get_success(
self.api.query_3pe(self.service, "user", PROTOCOL, {b"some": [b"field"]})
@@ -168,7 +168,7 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
)
# We assign to a method, which mypy doesn't like.
- self.api.get_json = Mock(side_effect=get_json) # type: ignore[assignment]
+ self.api.get_json = Mock(side_effect=get_json) # type: ignore[method-assign]
result = self.get_success(
self.api.query_3pe(self.service, "user", PROTOCOL, {b"some": [b"field"]})
@@ -215,7 +215,7 @@ class ApplicationServiceApiTestCase(unittest.HomeserverTestCase):
return RESPONSE
# We assign to a method, which mypy doesn't like.
- self.api.post_json_get_json = Mock(side_effect=post_json_get_json) # type: ignore[assignment]
+ self.api.post_json_get_json = Mock(side_effect=post_json_get_json) # type: ignore[method-assign]
MISSING_KEYS = [
# Known user, known device, missing algorithm.
diff --git a/tests/federation/test_complexity.py b/tests/federation/test_complexity.py
index 5b58fb13b5..73a2766baf 100644
--- a/tests/federation/test_complexity.py
+++ b/tests/federation/test_complexity.py
@@ -57,7 +57,7 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
async def get_current_state_event_counts(room_id: str) -> int:
return int(500 * 1.23)
- store.get_current_state_event_counts = get_current_state_event_counts # type: ignore[assignment]
+ store.get_current_state_event_counts = get_current_state_event_counts # type: ignore[method-assign]
# Get the room complexity again -- make sure it's our artificial value
channel = self.make_signed_federation_request(
@@ -74,8 +74,8 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join
- fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[assignment]
- handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[assignment]
+ fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[method-assign]
+ handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[method-assign]
return_value=("", 1)
)
@@ -105,8 +105,8 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join
- fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[assignment]
- handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[assignment]
+ fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[method-assign]
+ handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[method-assign]
return_value=("", 1)
)
@@ -142,8 +142,8 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join
- fed_transport.client.get_json = AsyncMock(return_value=None) # type: ignore[assignment]
- handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[assignment]
+ fed_transport.client.get_json = AsyncMock(return_value=None) # type: ignore[method-assign]
+ handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[method-assign]
return_value=("", 1)
)
@@ -151,7 +151,7 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
async def get_current_state_event_counts(room_id: str) -> int:
return 600
- self.hs.get_datastores().main.get_current_state_event_counts = get_current_state_event_counts # type: ignore[assignment]
+ self.hs.get_datastores().main.get_current_state_event_counts = get_current_state_event_counts # type: ignore[method-assign]
d = handler._remote_join(
create_requester(u1),
@@ -199,8 +199,8 @@ class RoomComplexityAdminTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join
- fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[assignment]
- handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[assignment]
+ fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[method-assign]
+ handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[method-assign]
return_value=("", 1)
)
@@ -229,8 +229,8 @@ class RoomComplexityAdminTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join
- fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[assignment]
- handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[assignment]
+ fed_transport.client.get_json = AsyncMock(return_value={"v1": 9999}) # type: ignore[method-assign]
+ handler.federation_handler.do_invite_join = AsyncMock( # type: ignore[method-assign]
return_value=("", 1)
)
diff --git a/tests/federation/test_federation_catch_up.py b/tests/federation/test_federation_catch_up.py
index 40318aa1b6..75ae740b43 100644
--- a/tests/federation/test_federation_catch_up.py
+++ b/tests/federation/test_federation_catch_up.py
@@ -50,7 +50,7 @@ class FederationCatchUpTestCases(FederatingHomeserverTestCase):
# This mock is crucial for destination_rooms to be populated.
# TODO: this seems to no longer be the case---tests pass with this mock
# commented out.
- state_storage_controller.get_current_hosts_in_room = AsyncMock( # type: ignore[assignment]
+ state_storage_controller.get_current_hosts_in_room = AsyncMock( # type: ignore[method-assign]
return_value={"test", "host2"}
)
@@ -436,7 +436,7 @@ class FederationCatchUpTestCases(FederatingHomeserverTestCase):
def wake_destination_track(destination: str) -> None:
woken.add(destination)
- self.federation_sender.wake_destination = wake_destination_track # type: ignore[assignment]
+ self.federation_sender.wake_destination = wake_destination_track # type: ignore[method-assign]
# We wait quite long so that all dests can be woken up, since there is a delay
# between them.
diff --git a/tests/federation/test_federation_sender.py b/tests/federation/test_federation_sender.py
index 5ea4a75a9f..7bd3d06859 100644
--- a/tests/federation/test_federation_sender.py
+++ b/tests/federation/test_federation_sender.py
@@ -47,11 +47,11 @@ class FederationSenderReceiptsTestCases(HomeserverTestCase):
federation_transport_client=self.federation_transport_client,
)
- hs.get_storage_controllers().state.get_current_hosts_in_room = AsyncMock( # type: ignore[assignment]
+ hs.get_storage_controllers().state.get_current_hosts_in_room = AsyncMock( # type: ignore[method-assign]
return_value={"test", "host2"}
)
- hs.get_storage_controllers().state.get_current_hosts_in_room_or_partial_state_approximation = ( # type: ignore[assignment]
+ hs.get_storage_controllers().state.get_current_hosts_in_room_or_partial_state_approximation = ( # type: ignore[method-assign]
hs.get_storage_controllers().state.get_current_hosts_in_room
)
diff --git a/tests/federation/transport/test_knocking.py b/tests/federation/transport/test_knocking.py
index 70209ab090..3f42f79f26 100644
--- a/tests/federation/transport/test_knocking.py
+++ b/tests/federation/transport/test_knocking.py
@@ -218,7 +218,7 @@ class FederationKnockingTestCase(
) -> EventBase:
return pdu
- homeserver.get_federation_server()._check_sigs_and_hash = ( # type: ignore[assignment]
+ homeserver.get_federation_server()._check_sigs_and_hash = ( # type: ignore[method-assign]
approve_all_signature_checking
)
@@ -229,7 +229,7 @@ class FederationKnockingTestCase(
) -> None:
pass
- homeserver.get_federation_event_handler()._check_event_auth = _check_event_auth # type: ignore[assignment]
+ homeserver.get_federation_event_handler()._check_event_auth = _check_event_auth # type: ignore[method-assign]
return super().prepare(reactor, clock, homeserver)
diff --git a/tests/handlers/test_appservice.py b/tests/handlers/test_appservice.py
index 4bd0facd65..46d022092e 100644
--- a/tests/handlers/test_appservice.py
+++ b/tests/handlers/test_appservice.py
@@ -400,11 +400,11 @@ class ApplicationServicesHandlerSendEventsTestCase(unittest.HomeserverTestCase):
# Mock the ApplicationServiceScheduler's _TransactionController's send method so that
# we can track any outgoing ephemeral events
self.send_mock = AsyncMock()
- hs.get_application_service_handler().scheduler.txn_ctrl.send = self.send_mock # type: ignore[assignment]
+ hs.get_application_service_handler().scheduler.txn_ctrl.send = self.send_mock # type: ignore[method-assign]
# Mock out application services, and allow defining our own in tests
self._services: List[ApplicationService] = []
- self.hs.get_datastores().main.get_app_services = Mock( # type: ignore[assignment]
+ self.hs.get_datastores().main.get_app_services = Mock( # type: ignore[method-assign]
return_value=self._services
)
@@ -898,11 +898,11 @@ class ApplicationServicesHandlerDeviceListsTestCase(unittest.HomeserverTestCase)
# Mock ApplicationServiceApi's put_json, so we can verify the raw JSON that
# will be sent over the wire
self.put_json = AsyncMock()
- hs.get_application_service_api().put_json = self.put_json # type: ignore[assignment]
+ hs.get_application_service_api().put_json = self.put_json # type: ignore[method-assign]
# Mock out application services, and allow defining our own in tests
self._services: List[ApplicationService] = []
- self.hs.get_datastores().main.get_app_services = Mock( # type: ignore[assignment]
+ self.hs.get_datastores().main.get_app_services = Mock( # type: ignore[method-assign]
return_value=self._services
)
@@ -1004,7 +1004,7 @@ class ApplicationServicesHandlerOtkCountsTestCase(unittest.HomeserverTestCase):
# Mock the ApplicationServiceScheduler's _TransactionController's send method so that
# we can track what's going out
self.send_mock = AsyncMock()
- hs.get_application_service_handler().scheduler.txn_ctrl.send = self.send_mock # type: ignore[assignment] # We assign to a method.
+ hs.get_application_service_handler().scheduler.txn_ctrl.send = self.send_mock # type: ignore[method-assign] # We assign to a method.
# Define an application service for the tests
self._service_token = "VERYSECRET"
diff --git a/tests/handlers/test_cas.py b/tests/handlers/test_cas.py
index 2cb24add20..8582b1cd1e 100644
--- a/tests/handlers/test_cas.py
+++ b/tests/handlers/test_cas.py
@@ -60,7 +60,7 @@ class CasHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
cas_response = CasResponse("test_user", {})
request = _mock_request()
@@ -88,7 +88,7 @@ class CasHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
# Map a user via SSO.
cas_response = CasResponse("test_user", {})
@@ -128,7 +128,7 @@ class CasHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
cas_response = CasResponse("föö", {})
request = _mock_request()
@@ -159,7 +159,7 @@ class CasHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
# The response doesn't have the proper userGroup or department.
cas_response = CasResponse("test_user", {})
diff --git a/tests/handlers/test_e2e_keys.py b/tests/handlers/test_e2e_keys.py
index 7917766a08..c5556f2844 100644
--- a/tests/handlers/test_e2e_keys.py
+++ b/tests/handlers/test_e2e_keys.py
@@ -800,7 +800,7 @@ class E2eKeysHandlerTestCase(unittest.HomeserverTestCase):
remote_master_key = "85T7JXPFBAySB/jwby4S3lBPTqY3+Zg53nYuGmu1ggY"
remote_self_signing_key = "QeIiFEjluPBtI7WQdG365QKZcFs9kqmHir6RBD0//nQ"
- self.hs.get_federation_client().query_client_keys = mock.AsyncMock( # type: ignore[assignment]
+ self.hs.get_federation_client().query_client_keys = mock.AsyncMock( # type: ignore[method-assign]
return_value={
"device_keys": {remote_user_id: {}},
"master_keys": {
@@ -876,7 +876,7 @@ class E2eKeysHandlerTestCase(unittest.HomeserverTestCase):
remote_master_key = "85T7JXPFBAySB/jwby4S3lBPTqY3+Zg53nYuGmu1ggY"
remote_self_signing_key = "QeIiFEjluPBtI7WQdG365QKZcFs9kqmHir6RBD0//nQ"
- self.hs.get_federation_client().query_user_devices = mock.AsyncMock( # type: ignore[assignment]
+ self.hs.get_federation_client().query_user_devices = mock.AsyncMock( # type: ignore[method-assign]
return_value={
"user_id": remote_user_id,
"stream_id": 1,
diff --git a/tests/handlers/test_federation.py b/tests/handlers/test_federation.py
index bd743b3578..21d63ab1f2 100644
--- a/tests/handlers/test_federation.py
+++ b/tests/handlers/test_federation.py
@@ -371,14 +371,14 @@ class FederationTestCase(unittest.FederatingHomeserverTestCase):
# We mock out the FederationClient.backfill method, to pretend that a remote
# server has returned our fake event.
federation_client_backfill_mock = AsyncMock(return_value=[event])
- self.hs.get_federation_client().backfill = federation_client_backfill_mock # type: ignore[assignment]
+ self.hs.get_federation_client().backfill = federation_client_backfill_mock # type: ignore[method-assign]
# We also mock the persist method with a side effect of itself. This allows us
# to track when it has been called while preserving its function.
persist_events_and_notify_mock = Mock(
side_effect=self.hs.get_federation_event_handler().persist_events_and_notify
)
- self.hs.get_federation_event_handler().persist_events_and_notify = ( # type: ignore[assignment]
+ self.hs.get_federation_event_handler().persist_events_and_notify = ( # type: ignore[method-assign]
persist_events_and_notify_mock
)
diff --git a/tests/handlers/test_oidc.py b/tests/handlers/test_oidc.py
index 9b2c7812cc..e797aaae00 100644
--- a/tests/handlers/test_oidc.py
+++ b/tests/handlers/test_oidc.py
@@ -157,7 +157,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
sso_handler = hs.get_sso_handler()
# Mock the render error method.
self.render_error = Mock(return_value=None)
- sso_handler.render_error = self.render_error # type: ignore[assignment]
+ sso_handler.render_error = self.render_error # type: ignore[method-assign]
# Reduce the number of attempts when generating MXIDs.
sso_handler._MAP_USERNAME_RETRIES = 3
@@ -165,7 +165,7 @@ class OidcHandlerTestCase(HomeserverTestCase):
auth_handler = hs.get_auth_handler()
# Mock the complete SSO login method.
self.complete_sso_login = AsyncMock()
- auth_handler.complete_sso_login = self.complete_sso_login # type: ignore[assignment]
+ auth_handler.complete_sso_login = self.complete_sso_login # type: ignore[method-assign]
return hs
diff --git a/tests/handlers/test_password_providers.py b/tests/handlers/test_password_providers.py
index 4496370c3f..11ec8c7f11 100644
--- a/tests/handlers/test_password_providers.py
+++ b/tests/handlers/test_password_providers.py
@@ -830,7 +830,7 @@ class PasswordAuthProviderTests(unittest.HomeserverTestCase):
username: The username to use for the test.
registration: Whether to test with registration URLs.
"""
- self.hs.get_identity_handler().send_threepid_validation = AsyncMock( # type: ignore[assignment]
+ self.hs.get_identity_handler().send_threepid_validation = AsyncMock( # type: ignore[method-assign]
return_value=0
)
diff --git a/tests/handlers/test_register.py b/tests/handlers/test_register.py
index a04234829f..e9fbf32c7c 100644
--- a/tests/handlers/test_register.py
+++ b/tests/handlers/test_register.py
@@ -202,7 +202,7 @@ class RegistrationTestCase(unittest.HomeserverTestCase):
@override_config({"limit_usage_by_mau": True})
def test_get_or_create_user_mau_not_blocked(self) -> None:
- self.store.count_monthly_users = AsyncMock( # type: ignore[assignment]
+ self.store.count_monthly_users = AsyncMock( # type: ignore[method-assign]
return_value=self.hs.config.server.max_mau_value - 1
)
# Ensure does not throw exception
@@ -299,7 +299,7 @@ class RegistrationTestCase(unittest.HomeserverTestCase):
def test_auto_create_auto_join_rooms_when_user_is_the_first_real_user(self) -> None:
room_alias_str = "#room:test"
- self.store.count_real_users = AsyncMock(return_value=1) # type: ignore[assignment]
+ self.store.count_real_users = AsyncMock(return_value=1) # type: ignore[method-assign]
self.store.is_real_user = AsyncMock(return_value=True)
user_id = self.get_success(self.handler.register_user(localpart="real"))
rooms = self.get_success(self.store.get_rooms_for_user(user_id))
@@ -314,7 +314,7 @@ class RegistrationTestCase(unittest.HomeserverTestCase):
def test_auto_create_auto_join_rooms_when_user_is_not_the_first_real_user(
self,
) -> None:
- self.store.count_real_users = AsyncMock(return_value=2) # type: ignore[assignment]
+ self.store.count_real_users = AsyncMock(return_value=2) # type: ignore[method-assign]
self.store.is_real_user = AsyncMock(return_value=True)
user_id = self.get_success(self.handler.register_user(localpart="real"))
rooms = self.get_success(self.store.get_rooms_for_user(user_id))
diff --git a/tests/handlers/test_saml.py b/tests/handlers/test_saml.py
index 6e666d7bed..00f4e181e8 100644
--- a/tests/handlers/test_saml.py
+++ b/tests/handlers/test_saml.py
@@ -133,7 +133,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
# send a mocked-up SAML response to the callback
saml_response = FakeAuthnResponse({"uid": "test_user", "username": "test_user"})
@@ -163,7 +163,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
# Map a user via SSO.
saml_response = FakeAuthnResponse(
@@ -205,11 +205,11 @@ class SamlHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
# mock out the error renderer too
sso_handler = self.hs.get_sso_handler()
- sso_handler.render_error = Mock(return_value=None) # type: ignore[assignment]
+ sso_handler.render_error = Mock(return_value=None) # type: ignore[method-assign]
saml_response = FakeAuthnResponse({"uid": "test", "username": "föö"})
request = _mock_request()
@@ -226,9 +226,9 @@ class SamlHandlerTestCase(HomeserverTestCase):
# stub out the auth handler and error renderer
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
sso_handler = self.hs.get_sso_handler()
- sso_handler.render_error = Mock(return_value=None) # type: ignore[assignment]
+ sso_handler.render_error = Mock(return_value=None) # type: ignore[method-assign]
# register a user to occupy the first-choice MXID
store = self.hs.get_datastores().main
@@ -311,7 +311,7 @@ class SamlHandlerTestCase(HomeserverTestCase):
# stub out the auth handler
auth_handler = self.hs.get_auth_handler()
- auth_handler.complete_sso_login = AsyncMock() # type: ignore[assignment]
+ auth_handler.complete_sso_login = AsyncMock() # type: ignore[method-assign]
# The response doesn't have the proper userGroup or department.
saml_response = FakeAuthnResponse({"uid": "test_user", "username": "test_user"})
diff --git a/tests/handlers/test_typing.py b/tests/handlers/test_typing.py
index d776526bc1..2a295da3a0 100644
--- a/tests/handlers/test_typing.py
+++ b/tests/handlers/test_typing.py
@@ -122,15 +122,15 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase):
self.datastore.get_destination_retry_timings = AsyncMock(return_value=None)
- self.datastore.get_device_updates_by_remote = AsyncMock( # type: ignore[assignment]
+ self.datastore.get_device_updates_by_remote = AsyncMock( # type: ignore[method-assign]
return_value=(0, [])
)
- self.datastore.get_destination_last_successful_stream_ordering = AsyncMock( # type: ignore[assignment]
+ self.datastore.get_destination_last_successful_stream_ordering = AsyncMock( # type: ignore[method-assign]
return_value=None
)
- self.datastore.get_received_txn_response = AsyncMock( # type: ignore[assignment]
+ self.datastore.get_received_txn_response = AsyncMock( # type: ignore[method-assign]
return_value=None
)
@@ -143,25 +143,25 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase):
raise AuthError(401, "User is not in the room")
return None
- hs.get_auth().check_user_in_room = Mock( # type: ignore[assignment]
+ hs.get_auth().check_user_in_room = Mock( # type: ignore[method-assign]
side_effect=check_user_in_room
)
async def check_host_in_room(room_id: str, server_name: str) -> bool:
return room_id == ROOM_ID
- hs.get_event_auth_handler().is_host_in_room = Mock( # type: ignore[assignment]
+ hs.get_event_auth_handler().is_host_in_room = Mock( # type: ignore[method-assign]
side_effect=check_host_in_room
)
async def get_current_hosts_in_room(room_id: str) -> Set[str]:
return {member.domain for member in self.room_members}
- hs.get_storage_controllers().state.get_current_hosts_in_room = Mock( # type: ignore[assignment]
+ hs.get_storage_controllers().state.get_current_hosts_in_room = Mock( # type: ignore[method-assign]
side_effect=get_current_hosts_in_room
)
- hs.get_storage_controllers().state.get_current_hosts_in_room_or_partial_state_approximation = Mock( # type: ignore[assignment]
+ hs.get_storage_controllers().state.get_current_hosts_in_room_or_partial_state_approximation = Mock( # type: ignore[method-assign]
side_effect=get_current_hosts_in_room
)
@@ -170,24 +170,24 @@ class TypingNotificationsTestCase(unittest.HomeserverTestCase):
self.datastore.get_users_in_room = Mock(side_effect=get_users_in_room)
- self.datastore.get_user_directory_stream_pos = AsyncMock( # type: ignore[assignment]
+ self.datastore.get_user_directory_stream_pos = AsyncMock( # type: ignore[method-assign]
# we deliberately return a non-None stream pos to avoid
# doing an initial_sync
return_value=1
)
- self.datastore.get_partial_current_state_deltas = Mock(return_value=(0, None)) # type: ignore[assignment]
+ self.datastore.get_partial_current_state_deltas = Mock(return_value=(0, None)) # type: ignore[method-assign]
- self.datastore.get_to_device_stream_token = Mock( # type: ignore[assignment]
+ self.datastore.get_to_device_stream_token = Mock( # type: ignore[method-assign]
return_value=0
)
- self.datastore.get_new_device_msgs_for_remote = AsyncMock( # type: ignore[assignment]
+ self.datastore.get_new_device_msgs_for_remote = AsyncMock( # type: ignore[method-assign]
return_value=([], 0)
)
- self.datastore.delete_device_msgs_for_remote = AsyncMock( # type: ignore[assignment]
+ self.datastore.delete_device_msgs_for_remote = AsyncMock( # type: ignore[method-assign]
return_value=None
)
- self.datastore.set_received_txn_response = AsyncMock( # type: ignore[assignment]
+ self.datastore.set_received_txn_response = AsyncMock( # type: ignore[method-assign]
return_value=None
)
diff --git a/tests/logging/test_terse_json.py b/tests/logging/test_terse_json.py
index fa27f1279a..c379853e20 100644
--- a/tests/logging/test_terse_json.py
+++ b/tests/logging/test_terse_json.py
@@ -164,7 +164,7 @@ class TerseJsonTestCase(LoggerCleanupMixin, TestCase):
# Call requestReceived to finish instantiating the object.
request.content = BytesIO()
# Partially skip some internal processing of SynapseRequest.
- request._started_processing = Mock() # type: ignore[assignment]
+ request._started_processing = Mock() # type: ignore[method-assign]
request.request_metrics = Mock(spec=["name"])
with patch.object(Request, "render"):
request.requestReceived(b"POST", b"/_matrix/client/versions", b"1.1")
diff --git a/tests/module_api/test_api.py b/tests/module_api/test_api.py
index 9ce9326190..172fc3a736 100644
--- a/tests/module_api/test_api.py
+++ b/tests/module_api/test_api.py
@@ -233,7 +233,7 @@ class ModuleApiTestCase(BaseModuleApiTestCase):
def test_sending_events_into_room(self) -> None:
"""Tests that a module can send events into a room"""
# Mock out create_and_send_nonmember_event to check whether events are being sent
- self.event_creation_handler.create_and_send_nonmember_event = Mock( # type: ignore[assignment]
+ self.event_creation_handler.create_and_send_nonmember_event = Mock( # type: ignore[method-assign]
spec=[],
side_effect=self.event_creation_handler.create_and_send_nonmember_event,
)
@@ -579,7 +579,7 @@ class ModuleApiTestCase(BaseModuleApiTestCase):
# Necessary to fake a remote join.
fake_stream_id = 1
mocked_remote_join = AsyncMock(return_value=("fake-event-id", fake_stream_id))
- self.hs.get_room_member_handler()._remote_join = mocked_remote_join # type: ignore[assignment]
+ self.hs.get_room_member_handler()._remote_join = mocked_remote_join # type: ignore[method-assign]
fake_remote_host = f"{self.module_api.server_name}-remote"
# Given that the join is to be faked, we expect the relevant join event not to
diff --git a/tests/push/test_bulk_push_rule_evaluator.py b/tests/push/test_bulk_push_rule_evaluator.py
index a3880ac171..7c23b77e0a 100644
--- a/tests/push/test_bulk_push_rule_evaluator.py
+++ b/tests/push/test_bulk_push_rule_evaluator.py
@@ -190,7 +190,7 @@ class TestBulkPushRuleEvaluator(HomeserverTestCase):
# Mock the method which calculates push rules -- we do this instead of
# e.g. checking the results in the database because we want to ensure
# that code isn't even running.
- bulk_evaluator._action_for_event_by_user = AsyncMock() # type: ignore[assignment]
+ bulk_evaluator._action_for_event_by_user = AsyncMock() # type: ignore[method-assign]
# Ensure no actions are generated!
self.get_success(bulk_evaluator.action_for_events_by_user([(event, context)]))
diff --git a/tests/replication/storage/test_events.py b/tests/replication/storage/test_events.py
index f7c6417a09..af25815fa5 100644
--- a/tests/replication/storage/test_events.py
+++ b/tests/replication/storage/test_events.py
@@ -58,7 +58,7 @@ def patch__eq__(cls: object) -> Callable[[], None]:
def unpatch() -> None:
if eq is not None:
- cls.__eq__ = eq # type: ignore[assignment]
+ cls.__eq__ = eq # type: ignore[method-assign]
return unpatch
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
diff --git a/tests/server.py b/tests/server.py
index 659ccce838..08633fe640 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -722,7 +722,7 @@ def _make_test_homeserver_synchronous(server: HomeServer) -> None:
**kwargs,
)
- pool.runWithConnection = runWithConnection # type: ignore[assignment]
+ pool.runWithConnection = runWithConnection # type: ignore[method-assign]
pool.runInteraction = runInteraction # type: ignore[assignment]
# Replace the thread pool with a threadless 'thread' pool
pool.threadpool = ThreadPool(clock._reactor)
diff --git a/tests/server_notices/test_resource_limits_server_notices.py b/tests/server_notices/test_resource_limits_server_notices.py
index 47c53a5475..17f428bfc5 100644
--- a/tests/server_notices/test_resource_limits_server_notices.py
+++ b/tests/server_notices/test_resource_limits_server_notices.py
@@ -69,7 +69,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
self._rlsn = rlsn
self._rlsn._store.user_last_seen_monthly_active = AsyncMock(return_value=1000)
- self._rlsn._server_notices_manager.send_notice = AsyncMock( # type: ignore[assignment]
+ self._rlsn._server_notices_manager.send_notice = AsyncMock( # type: ignore[method-assign]
return_value=Mock()
)
self._send_notice = self._rlsn._server_notices_manager.send_notice
@@ -82,8 +82,8 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
self._rlsn._server_notices_manager.maybe_get_notice_room_for_user = AsyncMock(
return_value="!something:localhost"
)
- self._rlsn._store.add_tag_to_room = AsyncMock(return_value=None) # type: ignore[assignment]
- self._rlsn._store.get_tags_for_room = AsyncMock(return_value={}) # type: ignore[assignment]
+ self._rlsn._store.add_tag_to_room = AsyncMock(return_value=None) # type: ignore[method-assign]
+ self._rlsn._store.get_tags_for_room = AsyncMock(return_value={}) # type: ignore[method-assign]
@override_config({"hs_disabled": True})
def test_maybe_send_server_notice_disabled_hs(self) -> None:
@@ -100,13 +100,13 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
def test_maybe_send_server_notice_to_user_remove_blocked_notice(self) -> None:
"""Test when user has blocked notice, but should have it removed"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None
)
mock_event = Mock(
type=EventTypes.Message, content={"msgtype": ServerNoticeMsgType}
)
- self._rlsn._store.get_events = AsyncMock( # type: ignore[assignment]
+ self._rlsn._store.get_events = AsyncMock( # type: ignore[method-assign]
return_value={"123": mock_event}
)
self.get_success(self._rlsn.maybe_send_server_notice_to_user(self.user_id))
@@ -122,7 +122,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
"""
Test when user has blocked notice, but notice ought to be there (NOOP)
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None,
side_effect=ResourceLimitError(403, "foo"),
)
@@ -130,7 +130,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
mock_event = Mock(
type=EventTypes.Message, content={"msgtype": ServerNoticeMsgType}
)
- self._rlsn._store.get_events = AsyncMock( # type: ignore[assignment]
+ self._rlsn._store.get_events = AsyncMock( # type: ignore[method-assign]
return_value={"123": mock_event}
)
@@ -142,7 +142,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
"""
Test when user does not have blocked notice, but should have one
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None,
side_effect=ResourceLimitError(403, "foo"),
)
@@ -155,7 +155,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
"""
Test when user does not have blocked notice, nor should they (NOOP)
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None
)
@@ -168,7 +168,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
Test when user is not part of the MAU cohort - this should not ever
happen - but ...
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None
)
self._rlsn._store.user_last_seen_monthly_active = AsyncMock(return_value=None)
@@ -184,7 +184,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
Test that when server is over MAU limit and alerting is suppressed, then
an alert message is not sent into the room
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None,
side_effect=ResourceLimitError(
403, "foo", limit_type=LimitBlockingTypes.MONTHLY_ACTIVE_USER
@@ -199,7 +199,7 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
"""
Test that when a server is disabled, that MAU limit alerting is ignored.
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None,
side_effect=ResourceLimitError(
403, "foo", limit_type=LimitBlockingTypes.HS_DISABLED
@@ -218,21 +218,21 @@ class TestResourceLimitsServerNotices(unittest.HomeserverTestCase):
When the room is already in a blocked state, test that when alerting
is suppressed that the room is returned to an unblocked state.
"""
- self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[assignment]
+ self._rlsn._auth_blocking.check_auth_blocking = AsyncMock( # type: ignore[method-assign]
return_value=None,
side_effect=ResourceLimitError(
403, "foo", limit_type=LimitBlockingTypes.MONTHLY_ACTIVE_USER
),
)
- self._rlsn._is_room_currently_blocked = AsyncMock( # type: ignore[assignment]
+ self._rlsn._is_room_currently_blocked = AsyncMock( # type: ignore[method-assign]
return_value=(True, [])
)
mock_event = Mock(
type=EventTypes.Message, content={"msgtype": ServerNoticeMsgType}
)
- self._rlsn._store.get_events = AsyncMock( # type: ignore[assignment]
+ self._rlsn._store.get_events = AsyncMock( # type: ignore[method-assign]
return_value={"123": mock_event}
)
self.get_success(self._rlsn.maybe_send_server_notice_to_user(self.user_id))
diff --git a/tests/storage/test_appservice.py b/tests/storage/test_appservice.py
index 48f39df9fe..cbce26a725 100644
--- a/tests/storage/test_appservice.py
+++ b/tests/storage/test_appservice.py
@@ -338,7 +338,7 @@ class ApplicationServiceTransactionStoreTestCase(unittest.HomeserverTestCase):
# we aren't testing store._base stuff here, so mock this out
# (ignore needed because Mypy won't allow us to assign to a method otherwise)
- self.store.get_events_as_list = AsyncMock(return_value=events) # type: ignore[assignment]
+ self.store.get_events_as_list = AsyncMock(return_value=events) # type: ignore[method-assign]
self.get_success(self._insert_txn(self.as_list[1]["id"], 9, other_events))
self.get_success(self._insert_txn(service.id, 10, events))
diff --git a/tests/storage/test_monthly_active_users.py b/tests/storage/test_monthly_active_users.py
index 0bf706ba08..49366440ce 100644
--- a/tests/storage/test_monthly_active_users.py
+++ b/tests/storage/test_monthly_active_users.py
@@ -252,7 +252,7 @@ class MonthlyActiveUsersTestCase(unittest.HomeserverTestCase):
)
self.get_success(d)
- self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[assignment]
+ self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[method-assign]
d = self.store.populate_monthly_active_users(user_id)
self.get_success(d)
@@ -260,9 +260,9 @@ class MonthlyActiveUsersTestCase(unittest.HomeserverTestCase):
self.store.upsert_monthly_active_user.assert_not_called()
def test_populate_monthly_users_should_update(self) -> None:
- self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[assignment]
+ self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[method-assign]
- self.store.is_trial_user = AsyncMock(return_value=False) # type: ignore[assignment]
+ self.store.is_trial_user = AsyncMock(return_value=False) # type: ignore[method-assign]
self.store.user_last_seen_monthly_active = AsyncMock(return_value=None)
d = self.store.populate_monthly_active_users("user_id")
@@ -271,9 +271,9 @@ class MonthlyActiveUsersTestCase(unittest.HomeserverTestCase):
self.store.upsert_monthly_active_user.assert_called_once()
def test_populate_monthly_users_should_not_update(self) -> None:
- self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[assignment]
+ self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[method-assign]
- self.store.is_trial_user = AsyncMock(return_value=False) # type: ignore[assignment]
+ self.store.is_trial_user = AsyncMock(return_value=False) # type: ignore[method-assign]
self.store.user_last_seen_monthly_active = AsyncMock(
return_value=self.hs.get_clock().time_msec()
)
@@ -356,7 +356,7 @@ class MonthlyActiveUsersTestCase(unittest.HomeserverTestCase):
@override_config({"limit_usage_by_mau": False, "mau_stats_only": False})
def test_no_users_when_not_tracking(self) -> None:
- self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[assignment]
+ self.store.upsert_monthly_active_user = AsyncMock(return_value=None) # type: ignore[method-assign]
self.get_success(self.store.populate_monthly_active_users("@user:sever"))
diff --git a/tests/test_federation.py b/tests/test_federation.py
index 779f70467b..f8ade6da38 100644
--- a/tests/test_federation.py
+++ b/tests/test_federation.py
@@ -80,7 +80,7 @@ class MessageAcceptTests(unittest.HomeserverTestCase):
) -> None:
pass
- federation_event_handler._check_event_auth = _check_event_auth # type: ignore[assignment]
+ federation_event_handler._check_event_auth = _check_event_auth # type: ignore[method-assign]
self.client = self.hs.get_federation_client()
async def _check_sigs_and_hash_for_pulled_events_and_fetch(
@@ -190,7 +190,7 @@ class MessageAcceptTests(unittest.HomeserverTestCase):
# Register the mock on the federation client.
federation_client = self.hs.get_federation_client()
- federation_client.query_user_devices = Mock(side_effect=query_user_devices) # type: ignore[assignment]
+ federation_client.query_user_devices = Mock(side_effect=query_user_devices) # type: ignore[method-assign]
# Register a mock on the store so that the incoming update doesn't fail because
# we don't share a room with the user.
@@ -240,7 +240,7 @@ class MessageAcceptTests(unittest.HomeserverTestCase):
# Register mock device list retrieval on the federation client.
federation_client = self.hs.get_federation_client()
- federation_client.query_user_devices = AsyncMock( # type: ignore[assignment]
+ federation_client.query_user_devices = AsyncMock( # type: ignore[method-assign]
return_value={
"user_id": remote_user_id,
"stream_id": 1,
diff --git a/tests/test_state.py b/tests/test_state.py
index eded38c766..9c8679cc1d 100644
--- a/tests/test_state.py
+++ b/tests/test_state.py
@@ -714,7 +714,7 @@ class StateTestCase(unittest.TestCase):
store = _DummyStore()
store.register_events(old_state_1)
store.register_events(old_state_2)
- self.dummy_store.get_events = store.get_events # type: ignore[assignment]
+ self.dummy_store.get_events = store.get_events # type: ignore[method-assign]
context: EventContext
context = yield self._get_context(
@@ -773,7 +773,7 @@ class StateTestCase(unittest.TestCase):
store = _DummyStore()
store.register_events(old_state_1)
store.register_events(old_state_2)
- self.dummy_store.get_events = store.get_events # type: ignore[assignment]
+ self.dummy_store.get_events = store.get_events # type: ignore[method-assign]
context: EventContext
context = yield self._get_context(
diff --git a/tests/unittest.py b/tests/unittest.py
index 40672a4415..5d3640d8ac 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -395,9 +395,9 @@ class HomeserverTestCase(TestCase):
)
# Type ignore: mypy doesn't like us assigning to methods.
- self.hs.get_auth().get_user_by_req = get_requester # type: ignore[assignment]
- self.hs.get_auth().get_user_by_access_token = get_requester # type: ignore[assignment]
- self.hs.get_auth().get_access_token_from_request = Mock(return_value=token) # type: ignore[assignment]
+ self.hs.get_auth().get_user_by_req = get_requester # type: ignore[method-assign]
+ self.hs.get_auth().get_user_by_access_token = get_requester # type: ignore[method-assign]
+ self.hs.get_auth().get_access_token_from_request = Mock(return_value=token) # type: ignore[method-assign]
if self.needs_threadpool:
self.reactor.threadpool = ThreadPool() # type: ignore[assignment]
|