def test_connect(m_connect): instance = mock.Mock() instance.private_ip_address = "ip1" instance.tags = {"Name": "n1"} ssh_client = SSHClient(instance, "u1", "k1") ssh_client.connect() m_connect.assert_called_once_with(hostname="ip1", username="******", key_filename="k1", timeout=10)
def test_connect(m_connect): instance = mock.Mock() instance.private_ip_address = "ip1" instance.tags = {"Name": "n1"} ssh_client = SSHClient(instance, "u1", "k1") ssh_client.connect() m_connect.assert_called_once_with(hostname="ip1", username="******", key_filename="k1", timeout=10)
def test_connect_returns_None(m_connect): instance = mock.Mock() instance.private_ip_address = "ip1" instance.tags = {"Name": "n1"} ssh_client = SSHClient(instance, "u1", "k1") m_connect.side_effect = Exception("Ooops") assert ssh_client.connect() is None
def test_connect_returns_None(m_connect): instance = mock.Mock() instance.private_ip_address = "ip1" instance.tags = {"Name": "n1"} ssh_client = SSHClient(instance, "u1", "k1") m_connect.side_effect = Exception("Ooops") assert ssh_client.connect() is None