def test_which_with_origin_flag(): """ Test pkgng.which with enabled origin flag """ which_cmd = MagicMock( return_value={ "stdout": "/usr/local/bin/mutt was installed by package mail/mutt", "retcode": 0, }) with patch.dict(pkgng.__salt__, {"cmd.run": which_cmd}): result = pkgng.which("/usr/local/bin/mutt", origin=True) assert result which_cmd.assert_called_with( ["pkg", "which", "-o", "/usr/local/bin/mutt"], output_loglevel="trace", python_shell=False, )
def test_which_with_default_flags(): """ Test pkgng.which """ which_cmd = MagicMock( return_value={ "stdout": ("/usr/local/bin/mutt was installed by package mutt-2.0.6"), "retcode": 0, } ) with patch.dict(pkgng.__salt__, {"cmd.run": which_cmd}): result = pkgng.which("/usr/local/bin/mutt") assert result which_cmd.assert_called_with( ["pkg", "which", "/usr/local/bin/mutt"], output_loglevel="trace", python_shell=False, )