mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 12:42:12 -04:00
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>
This commit is contained in:
parent
5ef673de4f
commit
78b99de7c2
14 changed files with 72 additions and 69 deletions
|
@ -226,7 +226,7 @@ class FederationSenderDevicesTestCases(HomeserverTestCase):
|
|||
# Send the server a device list EDU for the other user, this will cause
|
||||
# it to try and resync the device lists.
|
||||
self.hs.get_federation_transport_client().query_user_devices.return_value = (
|
||||
defer.succeed(
|
||||
make_awaitable(
|
||||
{
|
||||
"stream_id": "1",
|
||||
"user_id": "@user2:host2",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue