Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
New incantation of patch.object
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Jan 5, 2022
1 parent 33b9160 commit 9953d6c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/handlers/test_e2e_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
)

Expand Down

0 comments on commit 9953d6c

Please sign in to comment.