diff options
author | Sean Quah <8349537+squahtx@users.noreply.github.com> | 2022-04-27 14:58:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 14:58:26 +0100 |
commit | 78b99de7c206b106340e12cdee0af9aa246bd5ad (patch) | |
tree | 7eb94bb066b8ed0b23fa160056b5e9bcdb29dd8e /tests/test_federation.py | |
parent | Add a module API to allow modules to edit push rule actions (#12406) (diff) | |
download | synapse-78b99de7c206b106340e12cdee0af9aa246bd5ad.tar.xz |
Prefer `make_awaitable` over `defer.succeed` in tests (#12505)
When configuring the return values of mocks, prefer awaitables from `make_awaitable` over `defer.succeed`. `Deferred`s are only awaitable once, so it is inappropriate for a mock to return the same `Deferred` multiple times. Also update `run_in_background` to support functions that return arbitrary awaitables. Signed-off-by: Sean Quah <seanq@element.io>
Diffstat (limited to 'tests/test_federation.py')
-rw-r--r-- | tests/test_federation.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_federation.py b/tests/test_federation.py index c39816de85..0cbef70bfa 100644 --- a/tests/test_federation.py +++ b/tests/test_federation.py @@ -233,7 +233,7 @@ class MessageAcceptTests(unittest.HomeserverTestCase): # Register mock device list retrieval on the federation client. federation_client = self.homeserver.get_federation_client() federation_client.query_user_devices = Mock( - return_value=succeed( + return_value=make_awaitable( { "user_id": remote_user_id, "stream_id": 1, |