Skip to content

Commit

Permalink
Test that both new and old style messages are handled the same way
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jan 27, 2025
1 parent a305ae3 commit 2218859
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 2218859

Please sign in to comment.