Пример #1
0
 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)
Пример #2
0
 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)