From 2218859145bd58402336cc33d9e810851a26c13e Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Mon, 27 Jan 2025 13:48:00 -0500 Subject: [PATCH] Test that both new and old style messages are handled the same way --- tests/test_main.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index c5abb74c..14558699 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -339,15 +339,29 @@ def test_listen(self, mock_fedmsg, mock_handlers_issue, mock_handle_msg): "dummy", "d.d.d.github.issue.comment", self.old_style_mock_message, - ) + ), + ( + "dummy", + "dummy", + "d.d.d.github.issue.comment", + self.new_style_mock_message, + ), ] # Call the function m.listen(self.mock_config) # Assert everything was called correctly - mock_handle_msg.assert_called_with( - self.mock_message_body, "github.issue.comment", self.mock_config + # It should be called twice, once for the old style message and once for the new. + mock_handle_msg.assert_has_calls( + [ + mock.call( + self.mock_message_body, "github.issue.comment", self.mock_config + ), + mock.call( + self.mock_message_body, "github.issue.comment", self.mock_config + ), + ] ) @mock.patch(PATH + "send_mail")