def METHOD_NAME(self):
    api = InferenceApi("stabilityai/stable-diffusion-2-1")
    with patch("huggingface_hub.inference_api.get_session") as mock:
        mock().post.return_value.headers = {"Content-Type": "image/jpeg"}
        mock().post.return_value.content = self.read(self.image_file)
        output = api("cat", raw_response=True)
    # Raw response is returned
    self.assertEqual(output, mock().post.return_value)