Home / Function/ test_azure_openai_api_key_masked_when_passed_from_env() — langchain Function Reference

test_azure_openai_api_key_masked_when_passed_from_env() — langchain Function Reference

Architecture documentation for the test_azure_openai_api_key_masked_when_passed_from_env() function in test_secrets.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6dec71f4_bcd7_746a_9f44_2a0b4bdc782c["test_azure_openai_api_key_masked_when_passed_from_env()"]
  654b0dc2_a4de_700d_ff97_c27a5220678d["test_secrets.py"]
  6dec71f4_bcd7_746a_9f44_2a0b4bdc782c -->|defined in| 654b0dc2_a4de_700d_ff97_c27a5220678d
  style 6dec71f4_bcd7_746a_9f44_2a0b4bdc782c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/test_secrets.py lines 92–107

def test_azure_openai_api_key_masked_when_passed_from_env(
    model_class: type, monkeypatch: MonkeyPatch, capsys: CaptureFixture
) -> None:
    """Test that the API key is masked when passed from an environment variable."""
    monkeypatch.setenv("AZURE_OPENAI_API_KEY", "secret-api-key")
    monkeypatch.setenv("AZURE_OPENAI_AD_TOKEN", "secret-ad-token")
    model = model_class(azure_endpoint="endpoint", api_version="version")
    print(model.openai_api_key, end="")  # noqa: T201
    captured = capsys.readouterr()

    assert captured.out == "**********"

    print(model.azure_ad_token, end="")  # noqa: T201
    captured = capsys.readouterr()

    assert captured.out == "**********"

Domain

Subdomains

Frequently Asked Questions

What does test_azure_openai_api_key_masked_when_passed_from_env() do?
test_azure_openai_api_key_masked_when_passed_from_env() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/test_secrets.py.
Where is test_azure_openai_api_key_masked_when_passed_from_env() defined?
test_azure_openai_api_key_masked_when_passed_from_env() is defined in libs/partners/openai/tests/unit_tests/test_secrets.py at line 92.

Analyze Your Own Codebase

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

Try Supermodel Free