def test_get_disk_timeout(self): ''' Test to make sure we can get the disk 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}): ret = powercfg.get_disk_timeout() calls = [ call('powercfg /getactivescheme', python_shell=False), call('powercfg /q 381b4222-f694-41f0-9685-ff5bb260df2e SUB_DISK DISKIDLE', python_shell=False) ] mock.assert_has_calls(calls) self.assertEqual({'ac': 30, 'dc': 15}, ret)
def test_get_disk_timeout(self): """ Test to make sure we can get the disk timeout value """ mock = MagicMock() mock.side_effect = [ "Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)", self.query_output, ] with patch.dict(powercfg.__salt__, {"cmd.run": mock}): ret = powercfg.get_disk_timeout() calls = [ call("powercfg /getactivescheme", python_shell=False), call( "powercfg /q 381b4222-f694-41f0-9685-ff5bb260df2e SUB_DISK DISKIDLE", python_shell=False, ), ] mock.assert_has_calls(calls) self.assertEqual({"ac": 30, "dc": 15}, ret)