summary refs log tree commit diff
path: root/tests/rest/client/test_third_party_rules.py
diff options
context:
space:
mode:
authorH. Shay <hillerys@element.io>2023-03-16 14:49:47 -0700
committerH. Shay <hillerys@element.io>2023-03-16 14:49:47 -0700
commitad325833e237e89f88978c855f52dfabb0805691 (patch)
treeabae8f9b8a21e13b72caeff799d8ded59140f208 /tests/rest/client/test_third_party_rules.py
parentrequested changes (diff)
parentRemove no-op send_command for Redis replication. (#15274) (diff)
downloadsynapse-ad325833e237e89f88978c855f52dfabb0805691.tar.xz
Merge branch 'develop' into shay/rework_module
Diffstat (limited to 'tests/rest/client/test_third_party_rules.py')
-rw-r--r--tests/rest/client/test_third_party_rules.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/rest/client/test_third_party_rules.py b/tests/rest/client/test_third_party_rules.py

index 7245830b01..1bdb6bb6a5 100644 --- a/tests/rest/client/test_third_party_rules.py +++ b/tests/rest/client/test_third_party_rules.py
@@ -981,18 +981,16 @@ class ThirdPartyRulesTestCase(unittest.FederatingHomeserverTestCase): just before associating and removing a 3PID to/from an account. """ # Pretend to be a Synapse module and register both callbacks as mocks. - third_party_rules = self.hs.get_third_party_event_rules() on_add_user_third_party_identifier_callback_mock = Mock( return_value=make_awaitable(None) ) on_remove_user_third_party_identifier_callback_mock = Mock( return_value=make_awaitable(None) ) - third_party_rules._on_threepid_bind_callbacks.append( - on_add_user_third_party_identifier_callback_mock - ) - third_party_rules._on_threepid_bind_callbacks.append( - on_remove_user_third_party_identifier_callback_mock + third_party_rules = self.hs.get_third_party_event_rules() + third_party_rules.register_third_party_rules_callbacks( + on_add_user_third_party_identifier=on_add_user_third_party_identifier_callback_mock, + on_remove_user_third_party_identifier=on_remove_user_third_party_identifier_callback_mock, ) # Register an admin user. @@ -1048,12 +1046,12 @@ class ThirdPartyRulesTestCase(unittest.FederatingHomeserverTestCase): when a user is deactivated and their third-party ID associations are deleted. """ # Pretend to be a Synapse module and register both callbacks as mocks. - third_party_rules = self.hs.get_third_party_event_rules() on_remove_user_third_party_identifier_callback_mock = Mock( return_value=make_awaitable(None) ) - third_party_rules._on_threepid_bind_callbacks.append( - on_remove_user_third_party_identifier_callback_mock + third_party_rules = self.hs.get_third_party_event_rules() + third_party_rules.register_third_party_rules_callbacks( + on_remove_user_third_party_identifier=on_remove_user_third_party_identifier_callback_mock, ) # Register an admin user. @@ -1079,6 +1077,9 @@ class ThirdPartyRulesTestCase(unittest.FederatingHomeserverTestCase): ) self.assertEqual(channel.code, 200, channel.json_body) + # Check that the mock was not called on the act of adding a third-party ID. + on_remove_user_third_party_identifier_callback_mock.assert_not_called() + # Now deactivate the user. channel = self.make_request( "PUT",