Skip to content

Commit

Permalink
Remove outbound connector
Browse files Browse the repository at this point in the history
  • Loading branch information
erikh360 committed Feb 14, 2024
1 parent 63c9154 commit ee25c3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
13 changes: 3 additions & 10 deletions src/vumi2/applications/static_reply/static_reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
3 changes: 1 addition & 2 deletions tests/applications/test_static_reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee25c3d

Please sign in to comment.