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

Commit 7155892

Browse files
committed
fix test_spam_checker_may_join_room and test_threepid_invite_spamcheck
1 parent 5caeaaf commit 7155892

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/rest/client/test_rooms.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ async def user_may_join_room(
925925
) -> bool:
926926
return return_value
927927

928-
callback_mock = Mock(side_effect=user_may_join_room)
928+
callback_mock = Mock(side_effect=user_may_join_room, spec=lambda *x: None)
929929
self.hs.get_spam_checker()._user_may_join_room_callbacks.append(callback_mock)
930930

931931
# Join a first room, without being invited to it.
@@ -2598,7 +2598,9 @@ def test_threepid_invite_spamcheck(self) -> None:
25982598

25992599
# Add a mock to the spamchecker callbacks for user_may_send_3pid_invite. Make it
26002600
# 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)
26022604
self.hs.get_spam_checker()._user_may_send_3pid_invite_callbacks.append(mock)
26032605

26042606
# Send a 3PID invite into the room and check that it succeeded.

0 commit comments

Comments
 (0)