mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-13 06:52:17 -04:00
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
This commit is contained in:
parent
c9fc2c0d22
commit
39bed28b28
4 changed files with 64 additions and 26 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue