mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-09-27 23:50:54 -04:00
Convert federation client to async/await. (#7975)
This commit is contained in:
parent
4cce8ef74e
commit
c978f6c451
18 changed files with 209 additions and 221 deletions
|
@ -178,7 +178,7 @@ class QuarantineMediaTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
self.fetches = []
|
||||
|
||||
def get_file(destination, path, output_stream, args=None, max_size=None):
|
||||
async def get_file(destination, path, output_stream, args=None, max_size=None):
|
||||
"""
|
||||
Returns tuple[int,dict,str,int] of file length, response headers,
|
||||
absolute URI, and response code.
|
||||
|
@ -192,7 +192,7 @@ class QuarantineMediaTestCase(unittest.HomeserverTestCase):
|
|||
d = Deferred()
|
||||
d.addCallback(write_to)
|
||||
self.fetches.append((d, destination, path, args))
|
||||
return make_deferred_yieldable(d)
|
||||
return await make_deferred_yieldable(d)
|
||||
|
||||
client = Mock()
|
||||
client.get_file = get_file
|
||||
|
|
|
@ -53,7 +53,7 @@ class BaseRemoteKeyResourceTestCase(unittest.HomeserverTestCase):
|
|||
Tell the mock http client to expect an outgoing GET request for the given key
|
||||
"""
|
||||
|
||||
def get_json(destination, path, ignore_backoff=False, **kwargs):
|
||||
async def get_json(destination, path, ignore_backoff=False, **kwargs):
|
||||
self.assertTrue(ignore_backoff)
|
||||
self.assertEqual(destination, server_name)
|
||||
key_id = "%s:%s" % (signing_key.alg, signing_key.version)
|
||||
|
@ -177,7 +177,7 @@ class EndToEndPerspectivesTests(BaseRemoteKeyResourceTestCase):
|
|||
|
||||
# wire up outbound POST /key/v2/query requests from hs2 so that they
|
||||
# will be forwarded to hs1
|
||||
def post_json(destination, path, data):
|
||||
async def post_json(destination, path, data):
|
||||
self.assertEqual(destination, self.hs.hostname)
|
||||
self.assertEqual(
|
||||
path, "/_matrix/key/v2/query",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue