diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2021-11-26 17:13:48 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2021-12-08 18:30:52 +0000 |
commit | d7dc699f0a3c2b3a31b627bb5185b6352c87e613 (patch) | |
tree | 0952e43bd6b27ef76fd974d8a419e9534791a8f7 | |
parent | wip (diff) | |
download | synapse-d7dc699f0a3c2b3a31b627bb5185b6352c87e613.tar.xz |
rename ApplicationServices.is_interested -> is_interested_in_event
-rw-r--r-- | synapse/appservice/__init__.py | 2 | ||||
-rw-r--r-- | synapse/handlers/appservice.py | 2 | ||||
-rw-r--r-- | tests/appservice/test_appservice.py | 46 |
3 files changed, 38 insertions, 12 deletions
diff --git a/synapse/appservice/__init__.py b/synapse/appservice/__init__.py index e33e69eed1..c2e2132d59 100644 --- a/synapse/appservice/__init__.py +++ b/synapse/appservice/__init__.py @@ -207,7 +207,7 @@ class ApplicationService: return True return False - async def is_interested( + async def is_interested_in_event( self, event: EventBase, store: Optional["DataStore"] = None ) -> bool: """Check if this service is interested in this event. diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index 9c987d9bb5..122ec4ac1d 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -712,7 +712,7 @@ class ApplicationServicesHandler: # inside of a list comprehension anymore. interested_list = [] for s in services: - if await s.is_interested(event, self.store): + if await s.is_interested_in_event(event, self.store): interested_list.append(s) return interested_list diff --git a/tests/appservice/test_appservice.py b/tests/appservice/test_appservice.py index f386b5e128..8a8f5c61dd 100644 --- a/tests/appservice/test_appservice.py +++ b/tests/appservice/test_appservice.py @@ -50,7 +50,11 @@ class ApplicationServiceTestCase(unittest.TestCase): self.service.namespaces[ApplicationService.NS_USERS].append(_regex("@irc_.*")) self.event.sender = "@irc_foobar:matrix.org" self.assertTrue( - (yield defer.ensureDeferred(self.service.is_interested(self.event))) + ( + yield defer.ensureDeferred( + self.service.is_interested_in_event(self.event) + ) + ) ) @defer.inlineCallbacks @@ -58,7 +62,11 @@ class ApplicationServiceTestCase(unittest.TestCase): self.service.namespaces[ApplicationService.NS_USERS].append(_regex("@irc_.*")) self.event.sender = "@someone_else:matrix.org" self.assertFalse( - (yield defer.ensureDeferred(self.service.is_interested(self.event))) + ( + yield defer.ensureDeferred( + self.service.is_interested_in_event(self.event) + ) + ) ) @defer.inlineCallbacks @@ -68,7 +76,11 @@ class ApplicationServiceTestCase(unittest.TestCase): self.event.type = "m.room.member" self.event.state_key = "@irc_foobar:matrix.org" self.assertTrue( - (yield defer.ensureDeferred(self.service.is_interested(self.event))) + ( + yield defer.ensureDeferred( + self.service.is_interested_in_event(self.event) + ) + ) ) @defer.inlineCallbacks @@ -78,7 +90,11 @@ class ApplicationServiceTestCase(unittest.TestCase): ) self.event.room_id = "!some_prefixs0m3th1nGsome_suffix:matrix.org" self.assertTrue( - (yield defer.ensureDeferred(self.service.is_interested(self.event))) + ( + yield defer.ensureDeferred( + self.service.is_interested_in_event(self.event) + ) + ) ) @defer.inlineCallbacks @@ -88,7 +104,11 @@ class ApplicationServiceTestCase(unittest.TestCase): ) self.event.room_id = "!XqBunHwQIXUiqCaoxq:matrix.org" self.assertFalse( - (yield defer.ensureDeferred(self.service.is_interested(self.event))) + ( + yield defer.ensureDeferred( + self.service.is_interested_in_event(self.event) + ) + ) ) @defer.inlineCallbacks @@ -103,7 +123,7 @@ class ApplicationServiceTestCase(unittest.TestCase): self.assertTrue( ( yield defer.ensureDeferred( - self.service.is_interested(self.event, self.store) + self.service.is_interested_in_event(self.event, self.store) ) ) ) @@ -156,7 +176,7 @@ class ApplicationServiceTestCase(unittest.TestCase): self.assertFalse( ( yield defer.ensureDeferred( - self.service.is_interested(self.event, self.store) + self.service.is_interested_in_event(self.event, self.store) ) ) ) @@ -175,7 +195,7 @@ class ApplicationServiceTestCase(unittest.TestCase): self.assertTrue( ( yield defer.ensureDeferred( - self.service.is_interested(self.event, self.store) + self.service.is_interested_in_event(self.event, self.store) ) ) ) @@ -189,7 +209,11 @@ class ApplicationServiceTestCase(unittest.TestCase): self.event.content = {"membership": "invite"} self.event.state_key = self.service.sender self.assertTrue( - (yield defer.ensureDeferred(self.service.is_interested(self.event))) + ( + yield defer.ensureDeferred( + self.service.is_interested_in_event(self.event) + ) + ) ) @defer.inlineCallbacks @@ -205,7 +229,9 @@ class ApplicationServiceTestCase(unittest.TestCase): self.assertTrue( ( yield defer.ensureDeferred( - self.service.is_interested(event=self.event, store=self.store) + self.service.is_interested_in_event( + event=self.event, store=self.store + ) ) ) ) |