示例#1
0
 def test_installed(self):
     """
     Test installed function default
     """
     expected = UPDATES_LIST
     with patch("salt.utils.winapi.Com", autospec=True), patch(
         "win32com.client.Dispatch", autospec=True
     ), patch.object(
         salt.utils.win_update.WindowsUpdateAgent, "refresh", autospec=True
     ), patch.object(
         salt.utils.win_update, "Updates", autospec=True, return_value=Updates()
     ):
         result = win_wua.installed()
         self.assertDictEqual(result, expected)
示例#2
0
 def test_installed_summary(self):
     """
     Test installed function with summary=True
     """
     expected = UPDATES_SUMMARY
     # Remove all updates that are not installed
     with patch("salt.utils.winapi.Com", autospec=True), patch(
         "win32com.client.Dispatch", autospec=True
     ), patch.object(
         salt.utils.win_update.WindowsUpdateAgent, "refresh", autospec=True
     ), patch.object(
         salt.utils.win_update, "Updates", autospec=True, return_value=Updates()
     ):
         result = win_wua.installed(summary=True)
         self.assertDictEqual(result, expected)
示例#3
0
 def test_installed_kbs_only(self):
     """
     Test installed function with kbs_only=True
     """
     expected = set()
     for update in UPDATES_LIST:
         expected.update(UPDATES_LIST[update]["KBs"])
     expected = sorted(expected)
     # Remove all updates that are not installed
     with patch("salt.utils.winapi.Com", autospec=True), patch(
         "win32com.client.Dispatch", autospec=True
     ), patch.object(
         salt.utils.win_update.WindowsUpdateAgent, "refresh", autospec=True
     ), patch.object(
         salt.utils.win_update, "Updates", autospec=True, return_value=Updates()
     ):
         result = win_wua.installed(kbs_only=True)
         self.assertListEqual(result, expected)