def test_upgrade_available(self):
        mock = MagicMock(return_value='A\n B\n SAME')
        with patch.dict(pkgutil.__salt__, {'cmd.run_stdout': mock}):
            self.assertEqual(pkgutil.upgrade_available('CSWpython'), '')

        mock = MagicMock(side_effect=['A\n B\n SALT', None])
        with patch.dict(pkgutil.__salt__, {'cmd.run_stdout': mock}):
            self.assertEqual(pkgutil.upgrade_available('CSWpython'), 'SALT')

            self.assertEqual(pkgutil.upgrade_available('CSWpython'), '')

    # 'list_upgrades' function tests: 1
Test if there is an upgrade available for a certain package.
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/pkgutil_test.py/PkgutilTestCase.test_upgrade_available