diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2021-11-22 16:50:50 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2021-11-22 16:50:50 +0000 |
commit | 8f8226af3a1977f7ec2fdcc839074ab3093554f7 (patch) | |
tree | 332760c23fabe6645c79f4d7771585278adf0739 | |
parent | Simplify registration of appservices in tests (diff) | |
download | synapse-8f8226af3a1977f7ec2fdcc839074ab3093554f7.tar.xz |
Fix existing unit tests github/anoa/e2e_as anoa/e2e_as
There is so much mocking going on here. I look forward to replacing these one day.
-rw-r--r-- | tests/handlers/test_appservice.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/handlers/test_appservice.py b/tests/handlers/test_appservice.py index 90c97d2f8e..0bbbce71fd 100644 --- a/tests/handlers/test_appservice.py +++ b/tests/handlers/test_appservice.py @@ -47,12 +47,6 @@ class AppServiceHandlerTestCase(unittest.TestCase): self.handler = ApplicationServicesHandler(hs) self.event_source = hs.get_event_sources() - # Mock the ApplicationServiceScheduler queuer so that we can track any - # outgoing ephemeral events - self.mock_service_queuer = Mock() - self.mock_service_queuer.enqueue_ephemeral = Mock() - hs.get_application_service_handler().scheduler.queuer = self.mock_service_queuer - def test_notify_interested_services(self): interested_service = self._mkservice(is_interested=True) services = [ @@ -285,7 +279,7 @@ class AppServiceHandlerTestCase(unittest.TestCase): self.handler.notify_interested_services_ephemeral( "receipt_key", 580, ["@fakerecipient:example.com"] ) - self.mock_service_queuer.enqueue_ephemeral.assert_called_once_with( + self.mock_scheduler.submit_ephemeral_events_for_as.assert_called_once_with( interested_service, [event] ) self.mock_store.set_type_stream_id_for_appservice.assert_called_once_with( @@ -315,7 +309,10 @@ class AppServiceHandlerTestCase(unittest.TestCase): self.handler.notify_interested_services_ephemeral( "receipt_key", 580, ["@fakerecipient:example.com"] ) - self.mock_service_queuer.enqueue_ephemeral.assert_not_called() + # This method will be called, but with an empty list of events + self.mock_scheduler.submit_ephemeral_events_for_as.assert_called_once_with( + interested_service, [] + ) def _mkservice(self, is_interested, protocols=None): service = Mock() |