chore: address github-code-quality findings

This commit is contained in:
Greyson Lalonde
2026-05-05 03:01:04 +08:00
parent bada7fd909
commit bed0246438
5 changed files with 14 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ class TestPlusAPI(unittest.TestCase):
self.assertEqual(self.api.api_key, self.api_key)
self.assertEqual(self.api.headers["Authorization"], f"Bearer {self.api_key}")
self.assertEqual(self.api.headers["Content-Type"], "application/json")
self.assertTrue("CrewAI-CLI/" in self.api.headers["User-Agent"])
self.assertIn("CrewAI-CLI/", self.api.headers["User-Agent"])
self.assertTrue(self.api.headers["X-Crewai-Version"])
@patch("crewai_cli.plus_api.PlusAPI._make_request")

View File

@@ -1,7 +1,6 @@
"""Tests for TokenManager with atomic file operations."""
import json
import os
import tempfile
import unittest
from datetime import datetime, timedelta

View File

@@ -12,22 +12,28 @@ class BaseProvider(ABC):
self.settings = settings
@abstractmethod
def get_authorize_url(self) -> str: ...
def get_authorize_url(self) -> str:
"""Return the authorization endpoint URL."""
@abstractmethod
def get_token_url(self) -> str: ...
def get_token_url(self) -> str:
"""Return the token endpoint URL."""
@abstractmethod
def get_jwks_url(self) -> str: ...
def get_jwks_url(self) -> str:
"""Return the JWKS endpoint URL."""
@abstractmethod
def get_issuer(self) -> str: ...
def get_issuer(self) -> str:
"""Return the OAuth issuer identifier."""
@abstractmethod
def get_audience(self) -> str: ...
def get_audience(self) -> str:
"""Return the OAuth audience identifier."""
@abstractmethod
def get_client_id(self) -> str: ...
def get_client_id(self) -> str:
"""Return the OAuth client identifier."""
def get_required_fields(self) -> list[str]:
"""Returns which provider-specific fields inside the "extra" dict will be required."""

View File

@@ -182,7 +182,4 @@ class TokenManager:
"""
storage_path = self._get_secure_storage_path()
file_path = storage_path / filename
try:
file_path.unlink()
except FileNotFoundError:
pass
file_path.unlink(missing_ok=True)

View File

@@ -11,7 +11,6 @@ from crewai.llms.providers.openai.completion import OpenAICompletion, ResponsesA
from crewai.crew import Crew
from crewai.agent import Agent
from crewai.task import Task
from crewai.constants import DEFAULT_LLM_MODEL
def test_openai_completion_is_used_when_openai_provider():
"""