Skip to content

Commit

Permalink
Merge pull request #59 from brettp/patch-1
Browse files Browse the repository at this point in the history
Change naming of test
  • Loading branch information
filipre authored May 29, 2024
2 parents 4038975 + f8afaae commit bb1e084
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
)


class ChingChangChongCommand(Command):
triggers = ["ching", "chang"]
class OneTwoThreeCommand(Command):
triggers = ["one", "two"]

def __init__(self, listen):
self.listen = listen
Expand All @@ -22,26 +22,26 @@ async def handle(self, c: Context) -> bool:
return

text = c.message.text
if text == "ching":
if text == "one":
await asyncio.sleep(1)
await c.send("chang", listen=self.listen)
await c.send("two", listen=self.listen)
return

if text == "chang":
if text == "two":
await asyncio.sleep(1)
await c.send("chong")
await c.send("three")
return


# class EnabledListenChatTest(ChatTestCase):
# def setUp(self):
# super().setUp()
# self.signal_bot.register(ChingChangChongCommand(listen=True))
# self.signal_bot.register(OneTwoThreeCommand(listen=True))

# @patch("signalbot.SignalAPI.send", new_callable=SendMessagesMock)
# @patch("signalbot.SignalAPI.receive", new_callable=ReceiveMessagesMock)
# async def test_chat(self, receive_mock, send_mock):
# receive_mock.define(["ching"])
# receive_mock.define(["one"])
# await self.run_bot()
# self.assertEqual(send_mock.call_count, 2)

Expand All @@ -51,22 +51,22 @@ async def handle(self, c: Context) -> bool:
# super().setUp()
# group = {"id": "asdf", "name": "Test"}
# self.signal_bot._groups_by_internal_id = {"group_id1=": group}
# self.signal_bot.register(ChingChangChongCommand(listen=False))
# self.signal_bot.register(OneTwoThreeCommand(listen=False))

# @patch("signalbot.SignalAPI.send", new_callable=SendMessagesMock)
# @patch("signalbot.SignalAPI.receive", new_callable=ReceiveMessagesMock)
# async def test_chat(self, receive_mock, send_mock):
# receive_mock.define(["ching"])
# receive_mock.define(["one"])
# await self.run_bot()
# self.assertEqual(send_mock.call_count, 1)


# class DecoratorChatTest(ChatTestCase):
# def setUp(self):
# super().setUp()
# self.signal_bot.register(ChingChangChongCommand(listen=True))
# self.signal_bot.register(OneTwoThreeCommand(listen=True))

# @chat("how are you doing", "ching")
# @chat("how are you doing", "one")
# def test_chat(self, query, replies, reactions):
# self.assertEqual(replies.call_count, 2)

Expand Down

0 comments on commit bb1e084

Please sign in to comment.