summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorJess Porter <github@lolnerd.net>2022-05-13 12:17:38 +0100
committerGitHub <noreply@github.com>2022-05-13 12:17:38 +0100
commit39bed28b2843c79438d5cb51a6bb40e31c4420e7 (patch)
tree037959be843156319ec478c69623862a2455da1e /tests
parentUpdate issuer URL in example OIDC Keycloak config (#12727) (diff)
downloadsynapse-39bed28b2843c79438d5cb51a6bb40e31c4420e7.tar.xz
SpamChecker metrics (#12513)
* add Measure blocks all over SpamChecker

Signed-off-by: jesopo <github@lolnerd.net>

* fix test_spam_checker_may_join_room and test_threepid_invite_spamcheck

* better changelog entry
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/client/test_rooms.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/rest/client/test_rooms.py b/tests/rest/client/test_rooms.py
index ad416e2fd8..d0197aca94 100644
--- a/tests/rest/client/test_rooms.py
+++ b/tests/rest/client/test_rooms.py
@@ -925,7 +925,7 @@ class RoomJoinTestCase(RoomBase):
         ) -> bool:
             return return_value
 
-        callback_mock = Mock(side_effect=user_may_join_room)
+        callback_mock = Mock(side_effect=user_may_join_room, spec=lambda *x: None)
         self.hs.get_spam_checker()._user_may_join_room_callbacks.append(callback_mock)
 
         # Join a first room, without being invited to it.
@@ -2856,7 +2856,9 @@ class ThreepidInviteTestCase(unittest.HomeserverTestCase):
 
         # Add a mock to the spamchecker callbacks for user_may_send_3pid_invite. Make it
         # allow everything for now.
-        mock = Mock(return_value=make_awaitable(True))
+        # `spec` argument is needed for this function mock to have `__qualname__`, which
+        # is needed for `Measure` metrics buried in SpamChecker.
+        mock = Mock(return_value=make_awaitable(True), spec=lambda *x: None)
         self.hs.get_spam_checker()._user_may_send_3pid_invite_callbacks.append(mock)
 
         # Send a 3PID invite into the room and check that it succeeded.