Esempio n. 1
0
 def test_remove_noaction(self):
     """
     Test - Remove packages.
     """
     with patch(
             "salt.modules.opkg.list_pkgs",
             MagicMock(side_effect=[self.packages, self.packages]),
     ):
         std_out = "\nRemoving vim (7.4) from root...\n"
         ret_value = {"retcode": 0, "stdout": std_out}
         mock = MagicMock(return_value=ret_value)
         patch_kwargs = {
             "__salt__": {
                 "cmd.run_all":
                 mock,
                 "pkg_resource.parse_targets":
                 MagicMock(return_value=({
                     "vim": "7.4"
                 }, "repository")),
                 "restartcheck.restartcheck":
                 MagicMock(
                     return_value="No packages seem to need to be restarted"
                 ),
             }
         }
         with patch.multiple(opkg, **patch_kwargs):
             self.assertEqual(opkg.remove("vim:7.4", test=True),
                              self.removed)
Esempio n. 2
0
 def test_remove(self):
     '''
     Test - Remove packages.
     '''
     with patch('salt.modules.opkg.list_pkgs', MagicMock(side_effect=[PACKAGES, {}])):
         ret_value = {'retcode': 0}
         mock = MagicMock(return_value=ret_value)
         patch_kwargs = {
             '__salt__': {
                 'cmd.run_all': mock,
                 'pkg_resource.parse_targets': MagicMock(return_value=({'vim': '7.4'}, 'repository')),
                 'restartcheck.restartcheck': MagicMock(return_value='No packages seem to need to be restarted')
             }
         }
         with patch.multiple(opkg, **patch_kwargs):
             self.assertEqual(opkg.remove('vim'), REMOVED)
Esempio n. 3
0
 def test_remove_noaction(self):
     '''
     Test - Remove packages.
     '''
     with patch('salt.modules.opkg.list_pkgs', MagicMock(side_effect=[PACKAGES, PACKAGES])):
         std_out = '\nRemoving vim (7.4) from root...\n'
         ret_value = {'retcode': 0, 'stdout': std_out}
         mock = MagicMock(return_value=ret_value)
         patch_kwargs = {
             '__salt__': {
                 'cmd.run_all': mock,
                 'pkg_resource.parse_targets': MagicMock(return_value=({'vim': '7.4'}, 'repository')),
                 'restartcheck.restartcheck': MagicMock(return_value='No packages seem to need to be restarted')
             }
         }
         with patch.multiple(opkg, **patch_kwargs):
             self.assertEqual(opkg.remove('vim:7.4', test=True), REMOVED)
Esempio n. 4
0
 def test_remove(self):
     """
     Test - Remove packages.
     """
     with patch(
         "salt.modules.opkg.list_pkgs", MagicMock(side_effect=[self.packages, {}])
     ):
         ret_value = {"retcode": 0}
         mock = MagicMock(return_value=ret_value)
         patch_kwargs = {
             "__salt__": {
                 "cmd.run_all": mock,
                 "pkg_resource.parse_targets": MagicMock(
                     return_value=({"vim": "7.4"}, "repository")
                 ),
                 "restartcheck.restartcheck": MagicMock(
                     return_value="No packages seem to need to be restarted"
                 ),
             }
         }
         with patch.multiple(opkg, **patch_kwargs):
             self.assertEqual(opkg.remove("vim"), self.removed)