@@ -941,18 +941,16 @@ def test_on_add_and_remove_user_third_party_identifier(self) -> None:
941941 just before associating and removing a 3PID to/from an account.
942942 """
943943 # Pretend to be a Synapse module and register both callbacks as mocks.
944- third_party_rules = self .hs .get_third_party_event_rules ()
945944 on_add_user_third_party_identifier_callback_mock = Mock (
946945 return_value = make_awaitable (None )
947946 )
948947 on_remove_user_third_party_identifier_callback_mock = Mock (
949948 return_value = make_awaitable (None )
950949 )
951- third_party_rules ._on_threepid_bind_callbacks .append (
952- on_add_user_third_party_identifier_callback_mock
953- )
954- third_party_rules ._on_threepid_bind_callbacks .append (
955- on_remove_user_third_party_identifier_callback_mock
950+ third_party_rules = self .hs .get_third_party_event_rules ()
951+ third_party_rules .register_third_party_rules_callbacks (
952+ on_add_user_third_party_identifier = on_add_user_third_party_identifier_callback_mock ,
953+ on_remove_user_third_party_identifier = on_remove_user_third_party_identifier_callback_mock ,
956954 )
957955
958956 # Register an admin user.
@@ -1008,12 +1006,12 @@ def test_on_remove_user_third_party_identifier_is_called_on_deactivate(
10081006 when a user is deactivated and their third-party ID associations are deleted.
10091007 """
10101008 # Pretend to be a Synapse module and register both callbacks as mocks.
1011- third_party_rules = self .hs .get_third_party_event_rules ()
10121009 on_remove_user_third_party_identifier_callback_mock = Mock (
10131010 return_value = make_awaitable (None )
10141011 )
1015- third_party_rules ._on_threepid_bind_callbacks .append (
1016- on_remove_user_third_party_identifier_callback_mock
1012+ third_party_rules = self .hs .get_third_party_event_rules ()
1013+ third_party_rules .register_third_party_rules_callbacks (
1014+ on_remove_user_third_party_identifier = on_remove_user_third_party_identifier_callback_mock ,
10171015 )
10181016
10191017 # Register an admin user.
@@ -1039,6 +1037,9 @@ def test_on_remove_user_third_party_identifier_is_called_on_deactivate(
10391037 )
10401038 self .assertEqual (channel .code , 200 , channel .json_body )
10411039
1040+ # Check that the mock was not called on the act of adding a third-party ID.
1041+ on_remove_user_third_party_identifier_callback_mock .assert_not_called ()
1042+
10421043 # Now deactivate the user.
10431044 channel = self .make_request (
10441045 "PUT" ,
0 commit comments