Esempio n. 1
0
def test_wrong_pkey_type(cluster):
    instance = cluster.head
    pkey = {"wrong": "obj"}
    with pytest.raises(DaskEc2Exception):
        SSHClient(host=instance.ip,
                  username=instance.username,
                  port=instance.port,
                  password=None,
                  pkey=pkey)
Esempio n. 2
0
def test_ssh_fail_password(cluster):
    # NOTE: password is a little bit hardcoded to docker setup
    instance = cluster.head
    password = "******"
    with pytest.raises(DaskEc2Exception) as excinfo:
        SSHClient(host=instance.ip,
                  username=instance.username,
                  port=instance.port,
                  password=password,
                  pkey=None)
    assert "Authentication Error" in str(excinfo.value)
Esempio n. 3
0
def test_ssh_ok_pkey_obj(cluster):
    import os
    import paramiko
    instance = cluster.head
    keypath = os.path.expanduser(instance.keypair)
    pkey = paramiko.RSAKey.from_private_key_file(keypath)
    SSHClient(host=instance.ip,
              username=instance.username,
              port=instance.port,
              password=None,
              pkey=pkey)
Esempio n. 4
0
def test_ssh_ok_password(cluster):
    # NOTE: password is a little bit hardcoded to docker setup
    instance = cluster.head
    password = "******"
    client = SSHClient(host=instance.ip,
                       username=instance.username,
                       port=instance.port,
                       password=password,
                       pkey=None)
    client.exec_command("ls")
    client.close()
Esempio n. 5
0
def test_ssh_ok_password(cluster):
    instance = cluster.head
    password = "******"    # NOTE: this is a little bit hardcoded to docker setup
    client = SSHClient(host=instance.ip, username=instance.username, port=instance.port, password=password, pkey=None)
    reponse = client.exec_command("ls")
    client.close()