コード例 #1
0
 def test_install_noaction(self):
     """
     Test - Install packages.
     """
     with patch("salt.modules.opkg.list_pkgs",
                MagicMock(side_effect=({}, {}))):
         std_out = "Downloading http://feedserver/feeds/test/vim_7.4_arch.ipk.\n\nInstalling vim (7.4) on 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.install("vim:7.4", test=True),
                              self.installed)
コード例 #2
0
 def test_install(self):
     '''
     Test - Install 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.install('vim:7.4'), INSTALLED)
コード例 #3
0
 def test_install_noaction(self):
     '''
     Test - Install packages.
     '''
     with patch('salt.modules.opkg.list_pkgs', MagicMock(side_effect=({}, {}))):
         std_out = 'Downloading http://feedserver/feeds/test/vim_7.4_arch.ipk.\n\nInstalling vim (7.4) on 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.install('vim:7.4', test=True), INSTALLED)
コード例 #4
0
ファイル: test_opkg.py プロジェクト: paususe/salt-saltstack
 def test_install(self):
     """
     Test - Install 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.install("vim:7.4"), self.installed)