def test_user(self, mocker): mocker.patch('subprocess.call') ssh_connect(Host(hostname='host01.example.com', user='******'), []) subprocess.call.assert_called_with( ['ssh', 'host01.example.com', '-l', 'admin'])
def test_ipv4_(self, mocker): mocker.patch('subprocess.call') ssh_connect(Host(hostname='host01.example.com', ipv4='192.168.1.2'), ['-4']) subprocess.call.assert_called_with(['ssh', '192.168.1.2', '-4'], )
def test_ipv6(self, mocker): mocker.patch('subprocess.call') ssh_connect(Host(hostname='host01.example.com', ipv6='::1'), ['-6']) subprocess.call.assert_called_with(['ssh', '::1', '-6'])
def test_port(self, mocker): mocker.patch('subprocess.call') ssh_connect(Host(hostname='host01.example.com', port='22022'), []) subprocess.call.assert_called_with( ['ssh', 'host01.example.com', '-p', '22022'], )