Home / Class/ TestOllamaEmbeddingsUrlAuth Class — langchain Architecture

TestOllamaEmbeddingsUrlAuth Class — langchain Architecture

Architecture documentation for the TestOllamaEmbeddingsUrlAuth class in test_auth.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c4a6750f_a08b_199c_5b28_04df3d804c98["TestOllamaEmbeddingsUrlAuth"]
  24ba4b1a_1f94_bed7_6c96_5631284214c2["test_auth.py"]
  c4a6750f_a08b_199c_5b28_04df3d804c98 -->|defined in| 24ba4b1a_1f94_bed7_6c96_5631284214c2
  dc3c0bfc_e97f_248f_9716_b8a755dcb2ee["test_ollama_embeddings_url_auth_integration()"]
  c4a6750f_a08b_199c_5b28_04df3d804c98 -->|method| dc3c0bfc_e97f_248f_9716_b8a755dcb2ee

Relationship Graph

Source Code

libs/partners/ollama/tests/unit_tests/test_auth.py lines 171–194

class TestOllamaEmbeddingsUrlAuth:
    """Test URL authentication integration with OllamaEmbeddings."""

    @patch("langchain_ollama.embeddings.Client")
    @patch("langchain_ollama.embeddings.AsyncClient")
    def test_ollama_embeddings_url_auth_integration(
        self, mock_async_client: MagicMock, mock_client: MagicMock
    ) -> None:
        """Test that OllamaEmbeddings properly handles URL authentication."""
        url_with_auth = "https://user:password@ollama.example.com:11434"

        OllamaEmbeddings(
            model=MODEL_NAME,
            base_url=url_with_auth,
        )

        expected_url = "https://ollama.example.com:11434"
        expected_credentials = base64.b64encode(b"user:password").decode()
        expected_headers = {"Authorization": f"Basic {expected_credentials}"}

        mock_client.assert_called_once_with(host=expected_url, headers=expected_headers)
        mock_async_client.assert_called_once_with(
            host=expected_url, headers=expected_headers
        )

Frequently Asked Questions

What is the TestOllamaEmbeddingsUrlAuth class?
TestOllamaEmbeddingsUrlAuth is a class in the langchain codebase, defined in libs/partners/ollama/tests/unit_tests/test_auth.py.
Where is TestOllamaEmbeddingsUrlAuth defined?
TestOllamaEmbeddingsUrlAuth is defined in libs/partners/ollama/tests/unit_tests/test_auth.py at line 171.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free