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