Example #1
0
 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'])
Example #2
0
 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'], )
Example #3
0
 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'])
Example #4
0
 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'], )