Skip to content

Commit

Permalink
fix(test_mac_brew_pkg): adapt test to also mock path.which
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Ramón Sánchez Morales <[email protected]>
  • Loading branch information
arsa-dev authored and Megan Wilhite committed Aug 9, 2023
1 parent 2199d85 commit 4ac4da9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/pytests/unit/modules/test_mac_brew_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,9 @@ def test_homebrew_bin(HOMEBREW_BIN):
Tests the path to the homebrew binary
"""
mock_path = MagicMock(return_value="/usr/local")
with patch.dict(mac_brew.__salt__, {"cmd.run": mock_path}):
assert mac_brew._homebrew_bin() == HOMEBREW_BIN
with patch("salt.utils.path.which", MagicMock(return_value=HOMEBREW_BIN)):
with patch.dict(mac_brew.__salt__, {"cmd.run": mock_path}):
assert mac_brew._homebrew_bin() == HOMEBREW_BIN


# 'list_pkgs' function tests: 2
Expand Down

0 comments on commit 4ac4da9

Please sign in to comment.