This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -925,7 +925,7 @@ async def user_may_join_room(
925
925
) -> bool :
926
926
return return_value
927
927
928
- callback_mock = Mock (side_effect = user_may_join_room )
928
+ callback_mock = Mock (side_effect = user_may_join_room , spec = lambda * x : None )
929
929
self .hs .get_spam_checker ()._user_may_join_room_callbacks .append (callback_mock )
930
930
931
931
# Join a first room, without being invited to it.
@@ -2598,7 +2598,9 @@ def test_threepid_invite_spamcheck(self) -> None:
2598
2598
2599
2599
# Add a mock to the spamchecker callbacks for user_may_send_3pid_invite. Make it
2600
2600
# allow everything for now.
2601
- mock = Mock (return_value = make_awaitable (True ))
2601
+ # `spec` argument is needed for this function mock to have `__qualname__`, which
2602
+ # is needed for `Measure` metrics buried in SpamChecker.
2603
+ mock = Mock (return_value = make_awaitable (True ), spec = lambda * x : None )
2602
2604
self .hs .get_spam_checker ()._user_may_send_3pid_invite_callbacks .append (mock )
2603
2605
2604
2606
# Send a 3PID invite into the room and check that it succeeded.
You can’t perform that action at this time.
0 commit comments