diff --git a/claude_code_api/core/security.py b/claude_code_api/core/security.py index 41ce790..7ea799d 100644 --- a/claude_code_api/core/security.py +++ b/claude_code_api/core/security.py @@ -2,7 +2,6 @@ import os import re -from pathlib import Path import structlog from fastapi import HTTPException, status diff --git a/docker/oauth-proxy.py b/docker/oauth-proxy.py index a8db26d..24a3520 100644 --- a/docker/oauth-proxy.py +++ b/docker/oauth-proxy.py @@ -15,8 +15,7 @@ import argparse import logging import sys -from typing import Dict, Any -from urllib.parse import urlencode, parse_qs, urlparse +from typing import Dict try: from aiohttp import web, ClientSession, ClientError @@ -69,7 +68,7 @@ async def handle_oauth_callback(self, request: web.Request) -> web.Response: try: # Forward the callback with all query parameters async with session.get(target_url, params=query_params, timeout=10) as resp: - response_text = await resp.text() + await resp.text() logger.info(f"Container response: {resp.status}") diff --git a/tests/conftest.py b/tests/conftest.py index 67de9a5..5085f0f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,7 +3,6 @@ import json import os import shutil -import sys import tempfile from pathlib import Path @@ -11,16 +10,14 @@ from fastapi.testclient import TestClient from httpx import AsyncClient -# Add the project root to Python path for imports -PROJECT_ROOT = Path(__file__).parent.parent -sys.path.insert(0, str(PROJECT_ROOT)) - from claude_code_api.core.config import settings # Now import the app and configuration from claude_code_api.main import app from tests.model_utils import get_test_model_id +PROJECT_ROOT = Path(__file__).parent.parent + @pytest.fixture(scope="session", autouse=True) def setup_test_environment(): diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index 3885688..c61200e 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -13,12 +13,23 @@ import os import shutil import tempfile +from pathlib import Path from typing import Any, Dict, List import pytest from fastapi.testclient import TestClient from httpx import AsyncClient +from claude_code_api.core.config import settings +from claude_code_api.core.session_manager import SessionManager +from claude_code_api.main import app +from claude_code_api.models.claude import get_available_models +from tests.model_utils import get_test_model_id + +PROJECT_ROOT = Path(__file__).parent.parent +AVAILABLE_MODELS = get_available_models() +DEFAULT_MODEL = get_test_model_id() + def parse_sse_events(body_text: str) -> List[Dict[str, Any]]: """Parse SSE events from a streaming response body.""" @@ -33,24 +44,6 @@ def parse_sse_events(body_text: str) -> List[Dict[str, Any]]: return events -# Import the FastAPI app -import sys -from pathlib import Path - -# Add project root to path -PROJECT_ROOT = Path(__file__).parent.parent -sys.path.insert(0, str(PROJECT_ROOT)) - -from claude_code_api.core.config import settings -from claude_code_api.core.session_manager import SessionManager -from claude_code_api.main import app -from claude_code_api.models.claude import get_available_models -from tests.model_utils import get_test_model_id - -AVAILABLE_MODELS = get_available_models() -DEFAULT_MODEL = get_test_model_id() - - class TestConfig: """Test configuration."""