test: Add test for agent creation without model prices

- Add test to verify agent creation works without model prices
- Mock get_provider_data to return None
- Verify agent is created successfully

Part of #2116

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-02-12 21:52:57 +00:00
parent 3dd20e3503
commit ce44f3bc09

View File

@@ -78,6 +78,18 @@ def test_agent_default_values():
assert agent.llm.model == "gpt-4o-mini"
assert agent.allow_delegation is False
@pytest.mark.vcr(filter_headers=["authorization"])
def test_agent_creation_without_model_prices():
with patch('crewai.cli.provider.get_provider_data') as mock_get:
mock_get.return_value = None
agent = Agent(
role="test role",
goal="test goal",
backstory="test backstory"
)
assert agent is not None
assert agent.role == "test role"
def test_custom_llm():
agent = Agent(