RemoteOperations::exec_command must not raise and Exception when we define expect_error = True
|
if expect_error: |
|
raise Exception(result, error) |
Test case:
def test_exec_command_failure__expect_error(self):
"""
Test exec_command for command execution failure.
"""
cmd = "nonexistent_command"
exit_status, result, error = self.operations.exec_command(cmd, verbose=True, wait_exit=True, shell=True, expect_error=True)
assert error == b'bash: line 1: nonexistent_command: command not found\n'
assert exit_status == 127
assert result == b''