def test_unlock(self): """ Test pkgng.unlock """ unlock_cmd = MagicMock(return_value={ "stdout": ("pkga-1.0\n" "pkgb-2.0\n"), "retcode": 0 }) with patch.dict(pkgng.__salt__, {"cmd.run_all": unlock_cmd}): result = pkgng.unlock("pkga") self.assertFalse(result) unlock_cmd.assert_called_with( ["pkg", "unlock", "-y", "--quiet", "--show-locked", "pkga"], output_loglevel="trace", python_shell=False, ) result = pkgng.unlock("dummy") self.assertTrue(result) unlock_cmd.assert_called_with( ["pkg", "unlock", "-y", "--quiet", "--show-locked", "dummy"], output_loglevel="trace", python_shell=False, )
def test_unlock(self): ''' Test pkgng.unlock ''' unlock_cmd = MagicMock(return_value={ 'stdout': ('pkga-1.0\n' 'pkgb-2.0\n'), 'retcode': 0 }) with patch.dict(pkgng.__salt__, {'cmd.run_all': unlock_cmd}): result = pkgng.unlock('pkga') self.assertFalse(result) unlock_cmd.assert_called_with( ['pkg', 'unlock', '-y', '--quiet', '--show-locked', 'pkga'], output_loglevel='trace', python_shell=False) result = pkgng.unlock('dummy') self.assertTrue(result) unlock_cmd.assert_called_with( ['pkg', 'unlock', '-y', '--quiet', '--show-locked', 'dummy'], output_loglevel='trace', python_shell=False)