def test_list_recommended(self, mock_execute): mock_execute.return_value = CATALINA_LIST_OUTPUT result = mac_softwareupdate.list_available(recommended=True) expected = { "Command Line Tools beta 5 for Xcode-11.0": "11.0", "macOS Catalina Developer Beta-6": "5", "BridgeOSUpdateCustomer": "10.15.0.1.1.1560926689", } self.assertEqual(result, expected)
def test_list_recommended(self, mock_execute): mock_execute.return_value = MOJAVE_LIST_OUTPUT result = mac_softwareupdate.list_available(recommended=True) expected = { "Command Line Tools (macOS Mojave version 10.14) for Xcode-10.3": "10.3", "macOS 10.14.1 Update": "10.14.1", "BridgeOSUpdateCustomer": "10.14.4.1.1.1555388607", } self.assertEqual(result, expected)
def test_bigsur_list_shut_down(): with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [11, 0]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=CATALINA_LIST_OUTPUT), ): result = mac_softwareupdate.list_available(shut_down=True) expected = {"BridgeOSUpdateCustomer": "10.15.0.1.1.1560926689"} assert result == expected
def test_mojave_list_restart(): with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [10, 14, 6]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=MOJAVE_LIST_OUTPUT), ): result = mac_softwareupdate.list_available(restart=True) expected = {"macOS 10.14.1 Update": "10.14.1"} assert result == expected
def test_bigsur_list_restart(): with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [11, 0]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=CATALINA_LIST_OUTPUT), ): result = mac_softwareupdate.list_available(restart=True) expected = {"macOS Catalina Developer Beta-6": "5"} assert result == expected
def test_mojave_list_shut_down(): with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [10, 14, 6]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=MOJAVE_LIST_OUTPUT), ): result = mac_softwareupdate.list_available(shut_down=True) expected = {"BridgeOSUpdateCustomer": "10.14.4.1.1.1555388607"} assert result == expected
def test_list_available_trailing_ws(self, mock_execute): """Ensure the regex works with trailing whitespace in labels""" # This also tests for no version number returning an empty str. # This example's label will not install without the trailing space. mock_execute.return_value = ( "Software Update Tool\n\nFinding available software\nSoftware Update found" " the following new or updated software:\n * macOS Mojave 10.14.6" " Supplemental Update- \n macOS Mojave 10.14.6 Supplemental Update ( )," " 1581834K [recommended] [restart]") result = mac_softwareupdate.list_available() expected = {"macOS Mojave 10.14.6 Supplemental Update- ": ""} self.assertEqual(result, expected)
def test_bigsur_list_recommended(): with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [11, 0]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=CATALINA_LIST_OUTPUT), ): result = mac_softwareupdate.list_available(recommended=True) expected = { "Command Line Tools beta 5 for Xcode-11.0": "11.0", "macOS Catalina Developer Beta-6": "5", "BridgeOSUpdateCustomer": "10.15.0.1.1.1560926689", } assert result == expected
def test_mojave_list_recommended(): with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [10, 14, 6]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=MOJAVE_LIST_OUTPUT), ): result = mac_softwareupdate.list_available(recommended=True) expected = { "Command Line Tools (macOS Mojave version 10.14) for Xcode-10.3": "10.3", "macOS 10.14.1 Update": "10.14.1", "BridgeOSUpdateCustomer": "10.14.4.1.1.1555388607", } assert result == expected
def test_mojave_list_available_trailing_ws(): """Ensure the regex works with trailing whitespace in labels""" with patch.dict(mac_softwareupdate.__grains__, {"osrelease_info": [10, 14, 6]}): with patch( "salt.utils.mac_utils.execute_return_result", MagicMock(return_value=( "Software Update Tool\n\nFinding available software\nSoftware Update found" " the following new or updated software:\n * macOS Mojave 10.14.6" " Supplemental Update- \n macOS Mojave 10.14.6 Supplemental Update ( )," " 1581834K [recommended] [restart]")), ): result = mac_softwareupdate.list_available() expected = {"macOS Mojave 10.14.6 Supplemental Update- ": ""} assert result == expected
def test_list_shut_down(self, mock_execute): mock_execute.return_value = MOJAVE_LIST_OUTPUT result = mac_softwareupdate.list_available(shut_down=True) expected = {"BridgeOSUpdateCustomer": "10.14.4.1.1.1555388607"} self.assertEqual(result, expected)
def test_list_restart(self, mock_execute): mock_execute.return_value = MOJAVE_LIST_OUTPUT result = mac_softwareupdate.list_available(restart=True) expected = {"macOS 10.14.1 Update": "10.14.1"} self.assertEqual(result, expected)
def test_list_shut_down(self, mock_execute): mock_execute.return_value = CATALINA_LIST_OUTPUT result = mac_softwareupdate.list_available(shut_down=True) expected = {"BridgeOSUpdateCustomer": "10.15.0.1.1.1560926689"} self.assertEqual(result, expected)
def test_list_restart(self, mock_execute): mock_execute.return_value = CATALINA_LIST_OUTPUT result = mac_softwareupdate.list_available(restart=True) expected = {"macOS Catalina Developer Beta-6": "5"} self.assertEqual(result, expected)