code: def test_served_model_failed(
      mock_post, rai_forecasting_insights_for_served_model
  ):
      _, X_test, _, _ = create_tiny_forecasting_dataset()
  
      response = requests.Response()
      response.status_code = 400
      response._content = (
          b"Could not connect to host since it actively "
          b"refuses the connection."
      )
      mock_post.return_value = response
  
      rai_insights = RAIInsights.load(RAI_INSIGHTS_DIR_NAME)
      with pytest.raises(
          Exception,
          match="Could not retrieve predictions. "
          "Model server returned status code 400 "
          f"and the following response: {response.content}",
      ):
          rai_insights.model.forecast(X_test)
  
file_path: responsible-ai-toolbox/responsibleai/tests/rai_insights/test_served_model.py
imports: import json
  import random
  from unittest import mock
  import pytest
  import requests
  from tests.common_utils import RandomForecastingModel, create_tiny_forecasting_dataset
  from responsibleai import FeatureMetadata, RAIInsights
label_desc: Use image node_id 3 for calling a global function with example usage: test_served_model_failed(mock_post, rai_forecasting_insights_for_served_model) without return types