def test_set_monitor_timeout(self): ''' Test to make sure we can set the monitor timeout value ''' mock = MagicMock(return_value="") with patch.dict(powercfg.__salt__, {'cmd.run': mock}): powercfg.set_monitor_timeout(0, "dc") mock.assert_called_once_with('powercfg /x monitor-timeout-dc 0', python_shell=False)
def test_set_monitor_timeout(self): ''' Test to make sure we can set the monitor timeout value ''' mock = MagicMock() mock.side_effect = ["Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)", self.query_ouput] with patch.dict(powercfg.__salt__, {'cmd.run': mock}): powercfg.set_monitor_timeout(0, "dc") calls = [ call('powercfg /getactivescheme', python_shell=False), call('powercfg /setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e SUB_VIDEO VIDEOIDLE 0', python_shell=False) ] mock.assert_has_calls(calls)
def test_set_monitor_timeout(self): ''' Test to make sure we can set the monitor timeout value ''' mock = MagicMock(return_value=0) mock.side_effect = [ 'Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)', self.query_output ] mock_retcode = MagicMock(return_value=0) with patch.dict(powercfg.__salt__, {'cmd.run': mock}): with patch.dict(powercfg.__salt__, {'cmd.retcode': mock_retcode}): powercfg.set_monitor_timeout(0, 'dc') mock.assert_called_once_with('powercfg /getactivescheme', python_shell=False) mock_retcode.assert_called_once_with( 'powercfg /setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e SUB_VIDEO VIDEOIDLE 0', python_shell=False)
def test_set_monitor_timeout(self): """ Test to make sure we can set the monitor timeout value """ mock = MagicMock(return_value=0) mock.side_effect = [ "Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)", self.query_output, ] mock_retcode = MagicMock(return_value=0) with patch.dict(powercfg.__salt__, {"cmd.run": mock}): with patch.dict(powercfg.__salt__, {"cmd.retcode": mock_retcode}): powercfg.set_monitor_timeout(0, "dc") mock.assert_called_once_with("powercfg /getactivescheme", python_shell=False) mock_retcode.assert_called_once_with( "powercfg /setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e SUB_VIDEO VIDEOIDLE 0", python_shell=False, )