def test_embed_with_media_download_headers_and_model_auth(self):
        """
        Ensure that vectorise is called with the correct media_download_headers and model_auth
        when using the embed endpoint.
        """
        for index in [self.unstructured_default_image_index, self.structured_default_image_index]:
            with self.subTest(index=index.type):
                image_url = TestImageUrls.IMAGE1.value
                vectorise = s2_inference.vectorise
                def pass_through_vectorise(*arg, **kwargs):
                    """Vectorise will behave as usual, but we will be able to see the call list
                    via mock
                    Set image download headers and model auth to None so there's no error out.
                    """
                    kwargs["media_download_headers"] = None
                    kwargs["model_auth"] = None
                    return vectorise(*arg, **kwargs)

                mock_vectorise = unittest.mock.MagicMock()
                mock_vectorise.side_effect = pass_through_vectorise
                @unittest.mock.patch("marqo.s2_inference.s2_inference.vectorise", mock_vectorise)
                def run():
                    embed_res = embed(
                        marqo_config=self.config, index_name=index.name,
                        embedding_request=EmbedRequest(
                            content=[image_url],
                            mediaDownloadHeaders={"Authorization": "my secret key"},
                            modelAuth=ModelAuth(s3=S3Auth(
                                aws_access_key_id='12345',
                                aws_secret_access_key='this-is-a-secret'))
                        ),
                        device="cpu"
                    )
                    return True

                self.assertTrue(run())

                call_args = mock_vectorise.call_args_list
                self.assertEqual(len(call_args), 1)

                vectorise_kwargs = call_args[0].kwargs
                self.assertEqual(vectorise_kwargs["media_download_headers"], {"Authorization": "my secret key"})
                self.assertEqual(vectorise_kwargs["model_auth"], ModelAuth(s3=S3Auth(
                                aws_access_key_id='12345',
                                aws_secret_access_key='this-is-a-secret')))

        Ensure that vectorise is called with the correct media_download_headers and model_auth
        when using the embed endpoint.
        
tests/integ_tests/tensor_search/integ_tests/test_embed.py