def test_lock(self): """ Test pkgng.lock """ 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.lock("pkga") self.assertTrue(result) lock_cmd.assert_called_with( ["pkg", "lock", "-y", "--quiet", "--show-locked", "pkga"], output_loglevel="trace", python_shell=False, ) result = pkgng.lock("dummy") self.assertFalse(result) lock_cmd.assert_called_with( ["pkg", "lock", "-y", "--quiet", "--show-locked", "dummy"], output_loglevel="trace", python_shell=False, )
def test_lock(self): ''' Test pkgng.lock ''' 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.lock('pkga') self.assertTrue(result) lock_cmd.assert_called_with( ['pkg', 'lock', '-y', '--quiet', '--show-locked', 'pkga'], output_loglevel='trace', python_shell=False) result = pkgng.lock('dummy') self.assertFalse(result) lock_cmd.assert_called_with( ['pkg', 'lock', '-y', '--quiet', '--show-locked', 'dummy'], output_loglevel='trace', python_shell=False)