def test_get_base_ssh_command(self):
        client1 = ShellOutSSHClient(hostname='localhost', username='******')
        client2 = ShellOutSSHClient(hostname='localhost', username='******',
                                    key='/home/my.key')
        client3 = ShellOutSSHClient(hostname='localhost', username='******',
                                    key='/home/my.key', timeout=5)

        cmd1 = client1._get_base_ssh_command()
        cmd2 = client2._get_base_ssh_command()
        cmd3 = client3._get_base_ssh_command()

        self.assertEquals(cmd1, ['ssh', 'root@localhost'])
        self.assertEquals(cmd2, ['ssh', '-i', '/home/my.key',
                                 'root@localhost'])
        self.assertEquals(cmd3, ['ssh', '-i', '/home/my.key',
                                 '-oConnectTimeout=5', 'root@localhost'])
    def test_get_base_ssh_command(self):
        client1 = ShellOutSSHClient(hostname='localhost', username='******')
        client2 = ShellOutSSHClient(hostname='localhost', username='******',
                                    key='/home/my.key')
        client3 = ShellOutSSHClient(hostname='localhost', username='******',
                                    key='/home/my.key', timeout=5)

        cmd1 = client1._get_base_ssh_command()
        cmd2 = client2._get_base_ssh_command()
        cmd3 = client3._get_base_ssh_command()

        self.assertEqual(cmd1, ['ssh', 'root@localhost'])
        self.assertEqual(cmd2, ['ssh', '-i', '/home/my.key',
                                'root@localhost'])
        self.assertEqual(cmd3, ['ssh', '-i', '/home/my.key',
                                '-oConnectTimeout=5', 'root@localhost'])
Esempio n. 3
0
    def test_get_base_ssh_command(self):
        client1 = ShellOutSSHClient(hostname="localhost", username="******")
        client2 = ShellOutSSHClient(hostname="localhost",
                                    username="******",
                                    key="/home/my.key")
        client3 = ShellOutSSHClient(hostname="localhost",
                                    username="******",
                                    key="/home/my.key",
                                    timeout=5)

        cmd1 = client1._get_base_ssh_command()
        cmd2 = client2._get_base_ssh_command()
        cmd3 = client3._get_base_ssh_command()

        self.assertEqual(cmd1, ["ssh", "root@localhost"])
        self.assertEqual(cmd2, ["ssh", "-i", "/home/my.key", "root@localhost"])
        self.assertEqual(cmd3, [
            "ssh", "-i", "/home/my.key", "-oConnectTimeout=5", "root@localhost"
        ])