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

Commit

Permalink
Fix unawaited coroutine error in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Aug 12, 2020
1 parent fbe930d commit a53ea60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.d/8072.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert various parts of the codebase to async/await.
20 changes: 10 additions & 10 deletions tests/federation/test_complexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def test_join_too_large(self):
fed_transport = self.hs.get_federation_transport_client()

# 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(
return_value=make_awaitable(("", 1))
side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
)

d = handler._remote_join(
Expand Down Expand Up @@ -110,9 +110,9 @@ def test_join_too_large_admin(self):
fed_transport = self.hs.get_federation_transport_client()

# 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(
return_value=make_awaitable(("", 1))
side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
)

d = handler._remote_join(
Expand Down Expand Up @@ -148,9 +148,9 @@ def test_join_too_large_once_joined(self):
fed_transport = self.hs.get_federation_transport_client()

# 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(
return_value=make_awaitable(("", 1))
side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
)

# Artificially raise the complexity
Expand Down Expand Up @@ -204,9 +204,9 @@ def test_join_too_large_no_admin(self):
fed_transport = self.hs.get_federation_transport_client()

# 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(
return_value=make_awaitable(("", 1))
side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
)

d = handler._remote_join(
Expand Down Expand Up @@ -234,9 +234,9 @@ def test_join_too_large_admin(self):
fed_transport = self.hs.get_federation_transport_client()

# 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(
return_value=make_awaitable(("", 1))
side_effect=lambda *args, **kwargs: make_awaitable(("", 1))
)

d = handler._remote_join(
Expand Down

0 comments on commit a53ea60

Please sign in to comment.