new test for ssh failure host verification
@@ -34,12 +34,34 @@ def test_ssh_failed_with_multiple_passwords(buffer_connection, command_output_2_
ssh_cmd()
+def test_ssh_failed_host_key_verification(buffer_connection, command_output_failed_host_key_verification):
+ command_output, expected_result = command_output_failed_host_key_verification
+ buffer_connection.remote_inject_response([command_output])
+
+ ssh_cmd = Ssh(connection=buffer_connection.moler_connection, login="user", password="english",
+ host="host.domain.net", expected_prompt="host:.*#")
+ assert "TERM=xterm-mono ssh -l user host.domain.net" == ssh_cmd.command_string
+ with pytest.raises(CommandFailure):
+ ssh_cmd()
+
+
def test_ssh_returns_proper_command_string(buffer_connection):
ssh_cmd = Ssh(buffer_connection, login="user", password="english",
host="host.domain.net", expected_prompt="host:.*#")
assert "TERM=xterm-mono ssh -l user host.domain.net" == ssh_cmd.command_string
+@pytest.fixture
+def command_output_failed_host_key_verification():
+ data = """TERM=xterm-mono ssh -l user host.domain.net
+Host key verification failed
+host:~ #
+"""
+ result = dict()
+ return data, result
+
+
+
@pytest.fixture
def command_output_2_passwords():
lines = [
