Skip to content

Commit

Permalink
Use mock.patch.dict for dicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Feb 6, 2025
1 parent 2aaf370 commit 82111b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,16 @@ def test_listen_no_handlers(self, mock_load_config, mock_handle_msg):
# Assert everything was called correctly
mock_handle_msg.assert_not_called()

@mock.patch.dict(
PATH + "issue_handlers", {"github.issue.comment": lambda msg, c: "dummy_issue"}
)
@mock.patch(PATH + "handle_msg")
@mock.patch(PATH + "issue_handlers")
@mock.patch(PATH + "load_config")
def test_listen(self, mock_load_config, mock_handlers_issue, mock_handle_msg):
def test_listen(self, mock_load_config, mock_handle_msg):
"""
Test 'listen' function where everything goes smoothly
"""
# Set up return values
mock_handlers_issue["github.issue.comment"].return_value = "dummy_issue"
mock_load_config.return_value = self.mock_config

# Call the function once with the old style
Expand Down

0 comments on commit 82111b1

Please sign in to comment.