def test_login_false_userpass_ssh(self, credentials): """Verify AuthenticationException in case Incorrect password for ssh object. """ ssh_conn = clissh.CLISSH(credentials[0]) with pytest.raises(paramiko.AuthenticationException): ssh_conn = clissh.CLISSH(credentials[0]) ssh_conn.login(credentials[1], ssh_conn.randstr(30), timeout=5)
def test_import_clissh_module(): """Verify that all modules can be imported within 'clissh' module and 'CLISSH' object can be created. """ module_name = "clissh" try: from testlib import clissh clissh.CLISSH(None) except ImportError as err: pytest.fail("Import failure in '%s' module: %s" % (module_name, err))
def configure_server(self): """Create SSH connection to Collectd server host. """ self.class_logger.debug("Connect to the Collectd server") ssh = clissh.CLISSH(self.server.config['ip_host'], self.server.config['ip_port'], self.server.config['username'], self.server.config['password']) self.server.ssh = ssh self.server.ssh.login() self.server.ssh.open_shell()
def __init__(self, host, user, password): """Initialize IPerfRunner class. """ super(IPerfRunner, self).__init__() self.host = host self.user = user self.password = password self.ssh = clissh.CLISSH(host, 22, user, password, sudo_prompt="Password:")
def __init__(self, host=None, user=None, pasw=None, log_path=None): """Initialize SystemLog class. Args: host(str): Host IP address user(str): Host user pasw(str): Host password log_path(str): Path to logs """ self.host = host self.user = user self.pasw = pasw self.log_path = log_path self.ssh = clissh.CLISSH(self.host)
def test_pkey(self, credentials): ipaddr, username, password, param = credentials if param == "ssh": ssh_conn = clissh.CLISSH(ipaddr, username=username, pkey=self.EMPTY_PASSWORD_KEY) assert ssh_conn.pkey assert ssh_conn.pkey.get_bits() == 2048
def test_invalid_pkey_raises_SSHException(self, credentials): ipaddr, username, password, param = credentials if param == "ssh": with pytest.raises(paramiko.SSHException): ssh_conn = clissh.CLISSH(ipaddr, username=username, pkey="") assert ssh_conn.pkey
def create_ssh(request, host, login): ssh_conn = clissh.CLISSH(host, username=login, sudo_prompt="[sudo] password") return ssh_conn