diff --git a/tests/handlers/test_e2e_keys.py b/tests/handlers/test_e2e_keys.py index 1c00bf974128..734ed84d78d0 100644 --- a/tests/handlers/test_e2e_keys.py +++ b/tests/handlers/test_e2e_keys.py @@ -15,7 +15,6 @@ # limitations under the License. from typing import Iterable from unittest import mock -from unittest.mock import patch from parameterized import parameterized from signedjson import key as key, sign as sign @@ -881,14 +880,16 @@ def test_query_all_devices_caches_result(self, device_ids: Iterable[str]): # Pretend we're sharing a room with the user we're querying. If not, # `_query_devices_for_destination` will return early. - mock_get_rooms = patch.object( + mock_get_rooms = mock.patch.object( self.store, "get_rooms_for_user", - return_value=make_awaitable("some_room_id"), + new_callable=mock.MagicMock, + return_value=make_awaitable(["some_room_id"]), ) - mock_request = patch.object( + mock_request = mock.patch.object( self.hs.get_federation_client(), "query_user_devices", + new_callable=mock.MagicMock, return_value=make_awaitable(response_body), )