def test__connect_with_wait(self): auto_connect_ssh = AutoConnectSSH('user1', 'host1', wait=True) auto_connect_ssh._get_client = mock.Mock() auto_connect_ssh.wait = mock_wait = mock.Mock() auto_connect_ssh._connect() self.assertEqual(mock_wait.call_count, 1)
def test__connect_loop_ssh_error(self, mock_time): mock_time.time.side_effect = count() auto_connect_ssh = AutoConnectSSH('user1', 'host1', wait=10) auto_connect_ssh._get_client = mock__get_client = mock.Mock() mock__get_client.side_effect = exceptions.SSHError with self.assertRaises(exceptions.SSHTimeout): auto_connect_ssh._connect() self.assertEqual(mock_time.time.call_count, 12)
def test__connect_loop(self): auto_connect_ssh = AutoConnectSSH('user1', 'host1', wait=0) auto_connect_ssh._get_client = mock__get_client = mock.Mock() auto_connect_ssh._connect() mock__get_client.assert_called_once()
def test__connect_loop(self): auto_connect_ssh = AutoConnectSSH('user1', 'host1', wait=0) auto_connect_ssh._get_client = mock__get_client = mock.Mock() auto_connect_ssh._connect() self.assertEqual(mock__get_client.call_count, 1)