def test_TargetFactory_create_ssh_should_use_password(ssh_config):
    password = '******'
    ssh_config['password'] = password

    console = TargetFactory.create_ssh(Configuration(ssh_config),
                                       SystemContext())
    assert console.system.credentials.password == password
Ejemplo n.º 2
0
def test_TargetFactory_create_ssh(ssh_config):
    target = ssh_config['target']
    login = ssh_config['login']
    config = Configuration(copy.deepcopy(ssh_config))

    console = TargetFactory.create_ssh(config, SystemContext())
    assert console.target == target
    assert console.system.credentials.login == login
    assert console.system.credentials.password is None
def test_TargetFactory_create_ssh_should_default_to_credentials(ssh_config):
    ssh_config.pop('login')

    credslogin = '******'
    credspassword = '******'

    system = SystemContext(credentials=Credentials(credslogin, credspassword))
    console = TargetFactory.create_ssh(Configuration(ssh_config), system)
    assert console.system.credentials.login == credslogin
    assert console.system.credentials.password == credspassword
def test_TargetFactory_create_ssh_should_prefer_ssh_credentials(ssh_config):
    sshlogin = ssh_config['login']
    sshpassword = '******'
    ssh_config['password'] = sshpassword

    credslogin = '******'
    credspassword = '******'

    system = SystemContext(credentials=Credentials(credslogin, credspassword))
    console = TargetFactory.create_ssh(Configuration(ssh_config), system)
    assert console.system.credentials.login == sshlogin
    assert console.system.credentials.password == sshpassword