diff --git a/tests/rest/client/test_relations.py b/tests/rest/client/test_relations.py
index 9bfe913e45..d3f6191996 100644
--- a/tests/rest/client/test_relations.py
+++ b/tests/rest/client/test_relations.py
@@ -15,7 +15,7 @@
import urllib.parse
from typing import Any, Callable, Dict, List, Optional, Tuple
-from unittest.mock import patch
+from unittest.mock import AsyncMock, patch
from twisted.test.proto_helpers import MemoryReactor
@@ -28,7 +28,6 @@ from synapse.util import Clock
from tests import unittest
from tests.server import FakeChannel
-from tests.test_utils import make_awaitable
from tests.test_utils.event_injection import inject_event
from tests.unittest import override_config
@@ -264,7 +263,8 @@ class RelationsTestCase(BaseRelationsTestCase):
# Disable the validation to pretend this came over federation.
with patch(
"synapse.handlers.message.EventCreationHandler._validate_event_relation",
- new=lambda self, event: make_awaitable(None),
+ new_callable=AsyncMock,
+ return_value=None,
):
# Generate a various relations from a different room.
self.get_success(
@@ -1300,7 +1300,8 @@ class BundledAggregationsTestCase(BaseRelationsTestCase):
# not an event the Client-Server API will allow..
with patch(
"synapse.handlers.message.EventCreationHandler._validate_event_relation",
- new=lambda self, event: make_awaitable(None),
+ new_callable=AsyncMock,
+ return_value=None,
):
# Create a sub-thread off the thread, which is not allowed.
self._send_relation(
|