def test_installed_pkgs(self): ''' Test getting a list of the installed packages ''' expected = ['com.apple.this', 'com.salt.that'] mock = MagicMock(return_value='com.apple.this\ncom.salt.that') with patch.dict(macpackage.__salt__, {'cmd.run': mock}): out = macpackage.installed_pkgs() mock.assert_called_once_with('pkgutil --pkgs') self.assertEqual(out, expected)
def test_installed_pkgs(self): ''' Test getting a list of the installed packages ''' expected = ['com.apple.this', 'com.salt.that'] mock = MagicMock(return_value='com.apple.this\ncom.salt.that') with patch.dict(macpackage.__salt__, {'cmd.run': mock}): out = macpackage.installed_pkgs() mock.assert_called_once_with('pkgutil --pkgs') self.assertEqual(out, expected)