mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 13:48:09 +00:00
Remove unused platform_context context manager and env var fallback from context module. Token resolves from context var or env var via default_factory on the tool field. Replace custom __init__ with model_validator and use sanitize_tool_name.
27 lines
817 B
Python
27 lines
817 B
Python
# ruff: noqa: S105
|
|
|
|
from crewai.context import (
|
|
_platform_integration_token,
|
|
get_platform_integration_token,
|
|
)
|
|
|
|
|
|
class TestPlatformIntegrationToken:
|
|
def setup_method(self):
|
|
_platform_integration_token.set(None)
|
|
|
|
def teardown_method(self):
|
|
_platform_integration_token.set(None)
|
|
|
|
def test_set_and_get(self):
|
|
assert get_platform_integration_token() is None
|
|
_platform_integration_token.set("test-token-123")
|
|
assert get_platform_integration_token() == "test-token-123"
|
|
|
|
def test_returns_none_when_not_set(self):
|
|
assert get_platform_integration_token() is None
|
|
|
|
def test_overwrite(self):
|
|
_platform_integration_token.set("first")
|
|
_platform_integration_token.set("second")
|
|
assert get_platform_integration_token() == "second" |