def test_run_with_timeout(self, target_with_fakeconsole, mocker): t = target_with_fakeconsole d = ShellDriver(t, "shell", prompt='dummy', login_prompt='dummy', username='******') d.on_activate = mocker.MagicMock() d = t.get_driver('ShellDriver') d.run = mocker.MagicMock(return_value=[['success'], [], 0]) res = d.run_check("test", timeout=30.0) assert res == ['success']
def test_run_error(self, target_with_fakeconsole, mocker): t = target_with_fakeconsole d = ShellDriver(t, "shell", prompt='dummy', login_prompt='dummy', username='******') d.on_activate = mocker.MagicMock() d = t.get_driver('ShellDriver') d.run = mocker.MagicMock(return_value=[['error'], [], 1]) with pytest.raises(ExecutionError): res = d.run_check("test")