예제 #1
0
파일: pkgutil_test.py 프로젝트: DaveQB/salt
 def test_upgrade(self):
     '''
     Test if it upgrade all of the packages to the latest available version.
     '''
     mock_run = MagicMock(return_value='A\t B\t SAME')
     mock_ret = MagicMock(return_value=0)
     mock_pkg = MagicMock(return_value='')
     with patch.dict(pkgutil.__salt__,
                     {'cmd.run_stdout': mock_run,
                      'cmd.retcode': mock_ret,
                      'pkg_resource.stringify': mock_pkg,
                      'pkg_resource.sort_pkglist': mock_pkg,
                      'cmd.run_all': mock_ret, 'cmd.run': mock_run}):
         with patch.dict(pkgutil.__context__, {'pkg.list_pkgs': mock_ret}):
             self.assertDictEqual(pkgutil.upgrade(), {})
예제 #2
0
 def test_upgrade(self):
     '''
     Test if it upgrade all of the packages to the latest available version.
     '''
     mock_run = MagicMock(return_value='A\t B\t SAME')
     mock_ret = MagicMock(return_value=0)
     mock_pkg = MagicMock(return_value='')
     with patch.dict(pkgutil.__salt__,
                     {'cmd.run_stdout': mock_run,
                      'cmd.retcode': mock_ret,
                      'pkg_resource.stringify': mock_pkg,
                      'pkg_resource.sort_pkglist': mock_pkg,
                      'cmd.run_all': mock_ret, 'cmd.run': mock_run}):
         with patch.dict(pkgutil.__context__, {'pkg.list_pkgs': mock_ret}):
             self.assertDictEqual(pkgutil.upgrade(), {})
예제 #3
0
def test_upgrade():
    """
    Test if it upgrade all of the packages to the latest available version.
    """
    mock_run = MagicMock(return_value="A\t B\t SAME")
    mock_ret = MagicMock(return_value=0)
    mock_pkg = MagicMock(return_value="")
    with patch.dict(
            pkgutil.__salt__,
        {
            "cmd.run_stdout": mock_run,
            "cmd.retcode": mock_ret,
            "pkg_resource.stringify": mock_pkg,
            "pkg_resource.sort_pkglist": mock_pkg,
            "cmd.run_all": mock_ret,
            "cmd.run": mock_run,
        },
    ):
        with patch.dict(pkgutil.__context__, {"pkg.list_pkgs": mock_ret}):
            with patch.object(salt.utils.pkg, "clear_rtag", Mock()):
                assert pkgutil.upgrade() == {}