0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-16 06:51:46 +01:00

Fix unawaited coroutine error in tests. (#8072)

This commit is contained in:
Patrick Cloke 2020-08-13 07:11:39 -04:00 committed by GitHub
parent fbe930dad2
commit dd8f28bd3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 10 deletions

1
changelog.d/8072.misc Normal file
View file

@ -0,0 +1 @@
Convert various parts of the codebase to async/await.

View file

@ -79,9 +79,11 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client() fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join # Mock out some things, because we don't want to test the whole join
fed_transport.client.get_json = Mock(return_value=make_awaitable({"v1": 9999})) fed_transport.client.get_json = Mock(
side_effect=lambda *args, **kwargs: make_awaitable({"v1": 9999})
)
handler.federation_handler.do_invite_join = Mock( handler.federation_handler.do_invite_join = Mock(
return_value=make_awaitable(("", 1)) side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
) )
d = handler._remote_join( d = handler._remote_join(
@ -110,9 +112,11 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client() fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join # Mock out some things, because we don't want to test the whole join
fed_transport.client.get_json = Mock(return_value=make_awaitable({"v1": 9999})) fed_transport.client.get_json = Mock(
side_effect=lambda *args, **kwargs: make_awaitable({"v1": 9999})
)
handler.federation_handler.do_invite_join = Mock( handler.federation_handler.do_invite_join = Mock(
return_value=make_awaitable(("", 1)) side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
) )
d = handler._remote_join( d = handler._remote_join(
@ -148,9 +152,11 @@ class RoomComplexityTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client() fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join # Mock out some things, because we don't want to test the whole join
fed_transport.client.get_json = Mock(return_value=make_awaitable(None)) fed_transport.client.get_json = Mock(
side_effect=lambda *args, **kwargs: make_awaitable(None)
)
handler.federation_handler.do_invite_join = Mock( handler.federation_handler.do_invite_join = Mock(
return_value=make_awaitable(("", 1)) side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
) )
# Artificially raise the complexity # Artificially raise the complexity
@ -204,9 +210,11 @@ class RoomComplexityAdminTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client() fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join # Mock out some things, because we don't want to test the whole join
fed_transport.client.get_json = Mock(return_value=make_awaitable({"v1": 9999})) fed_transport.client.get_json = Mock(
side_effect=lambda *args, **kwargs: make_awaitable({"v1": 9999})
)
handler.federation_handler.do_invite_join = Mock( handler.federation_handler.do_invite_join = Mock(
return_value=make_awaitable(("", 1)) side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
) )
d = handler._remote_join( d = handler._remote_join(
@ -234,9 +242,11 @@ class RoomComplexityAdminTests(unittest.FederatingHomeserverTestCase):
fed_transport = self.hs.get_federation_transport_client() fed_transport = self.hs.get_federation_transport_client()
# Mock out some things, because we don't want to test the whole join # Mock out some things, because we don't want to test the whole join
fed_transport.client.get_json = Mock(return_value=make_awaitable({"v1": 9999})) fed_transport.client.get_json = Mock(
side_effect=lambda *args, **kwargs: make_awaitable({"v1": 9999})
)
handler.federation_handler.do_invite_join = Mock( handler.federation_handler.do_invite_join = Mock(
return_value=make_awaitable(("", 1)) side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
) )
d = handler._remote_join( d = handler._remote_join(