From 4ac4da9aa477d41fae5cbe1386205294de815d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ram=C3=B3n=20S=C3=A1nchez=20Morales?= Date: Fri, 30 Jun 2023 04:00:15 +0200 Subject: [PATCH] fix(test_mac_brew_pkg): adapt test to also mock path.which MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Antonio Ramón Sánchez Morales --- tests/pytests/unit/modules/test_mac_brew_pkg.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/pytests/unit/modules/test_mac_brew_pkg.py b/tests/pytests/unit/modules/test_mac_brew_pkg.py index f4ad86a66d2c..749c9765cce8 100644 --- a/tests/pytests/unit/modules/test_mac_brew_pkg.py +++ b/tests/pytests/unit/modules/test_mac_brew_pkg.py @@ -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