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

Commit

Permalink
Merge commit 'dd8f28bd3' into anoa/dinsic_release_1_21_x
Browse files Browse the repository at this point in the history
* commit 'dd8f28bd3':
  Fix unawaited coroutine error in tests. (#8072)
  • Loading branch information
anoadragon453 committed Oct 19, 2020
2 parents 1ab32bd + dd8f28b commit 464db5f
Show file tree
Hide file tree
Showing 2 changed files with 21 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.
30 changes: 20 additions & 10 deletions tests/federation/test_complexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ 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 +112,11 @@ 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 +152,11 @@ 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 +210,11 @@ 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 +242,11 @@ 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 464db5f

Please sign in to comment.