From ee25c3d6cccff5ce9ad9aaa0304f6c677292ad35 Mon Sep 17 00:00:00 2001 From: Erik Harding Date: Wed, 14 Feb 2024 15:14:21 +0200 Subject: [PATCH] Remove outbound connector --- src/vumi2/applications/static_reply/static_reply.py | 13 +++---------- tests/applications/test_static_reply.py | 3 +-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/vumi2/applications/static_reply/static_reply.py b/src/vumi2/applications/static_reply/static_reply.py index 9064695..3ad740a 100644 --- a/src/vumi2/applications/static_reply/static_reply.py +++ b/src/vumi2/applications/static_reply/static_reply.py @@ -14,16 +14,12 @@ class StaticReplyApplication(BaseWorker): """ A static reply application - It will reply to any inbound message with the exonfigured reply text + It will reply to any inbound message with the configured reply text """ config: StaticReplyConfig async def setup(self) -> None: - await self.setup_receive_outbound_connector( - connector_name=self.config.transport_name, - outbound_handler=self.handle_outbound_message, - ) await self.setup_receive_inbound_connector( connector_name=self.config.transport_name, inbound_handler=self.handle_inbound_message, @@ -35,12 +31,9 @@ async def setup(self) -> None: async def handle_inbound_message(self, message: Message): reply_msg = message.reply(self.config.reply_text, Session.CLOSE) - await self.receive_outbound_connectors[ + await self.receive_inbound_connectors[ self.config.transport_name - ].publish_inbound(reply_msg) + ].publish_outbound(reply_msg) async def handle_event(self, event: Event): pass - - async def handle_outbound_message(self, message: Message): - pass diff --git a/tests/applications/test_static_reply.py b/tests/applications/test_static_reply.py index 79bacdd..f7e285b 100644 --- a/tests/applications/test_static_reply.py +++ b/tests/applications/test_static_reply.py @@ -27,12 +27,11 @@ async def test_static_reply(static_reply, connector_factory): transport_type=TransportType.USSD, ) - ri_test = await connector_factory.setup_ri(TEST_CONFIG["transport_name"]) ro_test = await connector_factory.setup_ro(TEST_CONFIG["transport_name"]) await ro_test.publish_inbound(msg1) - reply = await ri_test.consume_inbound() + reply = await ro_test.consume_outbound() assert reply.content == TEST_CONFIG["reply_text"] assert reply.session_event == Session.CLOSE