def test_invalid_ssh_config(self): client = SSHClient() with self.assertRaises(Exception) as context: client.parse_config('127.0.0.1') assert context.exception.args[0] == 'Unparsable line &'
def test_include_loop_ssh_config(self): client = SSHClient() with self.assertRaises(Exception) as context: client.parse_config('127.0.0.1') assert context.exception.args[0] == 'Include loop detected in ssh config file: other_file'
def test_load_ssh_config(self): client = SSHClient() _, config = client.parse_config('127.0.0.1') assert config.get('key_filename') == ['/id_rsa', '/id_rsa2'] assert config.get('username') == 'testuser' assert config.get('port') == 33 assert isinstance(config.get('sock'), ProxyCommand) _, other_config = client.parse_config('192.168.1.1') assert other_config.get('username') == 'otheruser'
def test_invalid_ssh_config(self): client = SSHClient() with self.assertRaises(Exception): _, config = client.parse_config('127.0.0.1')