示例#1
0
 def test_list_upgrades(self):
     '''
     Test if it list all available package upgrades on this system.
     '''
     mock_run = MagicMock(return_value='A\t B\t SAME')
     mock_ret = MagicMock(return_value=0)
     with patch.dict(pkgutil.__salt__, {'cmd.run_stdout': mock_run,
                                        'cmd.retcode': mock_ret}):
         self.assertDictEqual(pkgutil.list_upgrades(), {'A': ' B'})
示例#2
0
 def test_list_upgrades(self):
     '''
     Test if it list all available package upgrades on this system.
     '''
     mock_run = MagicMock(return_value='A\t B\t SAME')
     mock_ret = MagicMock(return_value=0)
     with patch.dict(pkgutil.__salt__, {'cmd.run_stdout': mock_run,
                                        'cmd.retcode': mock_ret}):
         self.assertDictEqual(pkgutil.list_upgrades(), {'A': ' B'})
示例#3
0
def test_list_upgrades():
    """
    Test if it list all available package upgrades on this system.
    """
    mock_run = MagicMock(return_value="A\t B\t SAME")
    mock_ret = MagicMock(return_value=0)
    with patch.dict(pkgutil.__salt__, {
            "cmd.run_stdout": mock_run,
            "cmd.retcode": mock_ret
    }):
        with patch.object(salt.utils.pkg, "clear_rtag", Mock()):
            assert pkgutil.list_upgrades() == {"A": " B"}