fix test for help command

This commit is contained in:
HgO 2024-04-18 12:03:05 +02:00
parent 2baaf5e310
commit d94ebdb3d8

View file

@ -109,7 +109,8 @@ class CommandTestCase(unittest.IsolatedAsyncioTestCase):
# We don't spec config, as it doesn't currently have well defined attributes # We don't spec config, as it doesn't currently have well defined attributes
self.fake_config = Mock() self.fake_config = Mock()
self.fake_config.allowed_rooms = [self.fake_room.room_id] self.fake_config.allowed_rooms = [self.fake_room.room_id]
self.fake_config.allowed_reactions = {"🤫", "😶", "🤐"} self.fake_config.allowed_reactions = {"🤫", "😶", "🤐", "🤗"}
self.fake_config.insult_reactions = {"🤗"}
@patch.object(matrix_alertbot.command.AckAlertCommand, "process") @patch.object(matrix_alertbot.command.AckAlertCommand, "process")
async def test_process_ack_command(self, fake_ack: Mock) -> None: async def test_process_ack_command(self, fake_ack: Mock) -> None:
@ -671,6 +672,13 @@ class CommandTestCase(unittest.IsolatedAsyncioTestCase):
fake_send_text_to_room.assert_called_once() fake_send_text_to_room.assert_called_once()
_, _, text = fake_send_text_to_room.call_args.args _, _, text = fake_send_text_to_room.call_args.args
self.assertIn("Here is the list of available commands", text) self.assertIn("Here is the list of available commands", text)
reactions = (
self.fake_config.allowed_reactions - self.fake_config.insult_reactions
)
for reaction in reactions:
self.assertIn(reaction, text)
for reaction in self.fake_config.insult_reactions:
self.assertNotIn(reaction, text)
@patch.object(matrix_alertbot.command, "send_text_to_room") @patch.object(matrix_alertbot.command, "send_text_to_room")
async def test_angry_user(self, fake_send_text_to_room: Mock) -> None: async def test_angry_user(self, fake_send_text_to_room: Mock) -> None: