CORS Fixed + black and ruff fixes

This commit is contained in:
Yûki VACHOT 2025-12-01 02:55:47 +01:00
parent 5e2f6078a1
commit 3844ffc207
30 changed files with 85 additions and 114 deletions

View file

@ -9,7 +9,7 @@ from geoguessr_mcp.api import GeoGuessrClient
from geoguessr_mcp.api.dynamic_response import DynamicResponse
from geoguessr_mcp.auth import SessionManager, UserSession
from geoguessr_mcp.config import settings
from geoguessr_mcp.models import RoundGuess, Game
from geoguessr_mcp.models import Game, RoundGuess
from geoguessr_mcp.services import AnalysisService, GameService, ProfileService

View file

@ -10,7 +10,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
import httpx
import pytest
from geoguessr_mcp.api import DynamicResponse, GeoGuessrClient, EndpointInfo, Endpoints
from geoguessr_mcp.api import DynamicResponse, EndpointInfo, Endpoints, GeoGuessrClient
from geoguessr_mcp.config import settings

View file

@ -187,7 +187,7 @@ class TestAuthenticationFlow:
assert "expired_user" not in session_manager._user_sessions
@pytest.mark.asyncio
async def test_default_cookie_fallback(self, session_manager):
async def test_default_cookie_fallback(self):
"""Test falling back to default cookie when no session exists."""
# Create manager with default cookie
manager_with_default = SessionManager(default_cookie="default_test_cookie")

View file

@ -26,8 +26,8 @@ class TestMultiUserSessionManager:
@pytest.mark.asyncio
async def test_get_user_context_reuses_existing_manager(self, manager):
"""Test that getting context for existing API key reuses the same manager."""
context1 = await manager.get_user_context("existing_key")
context2 = await manager.get_user_context("existing_key")
await manager.get_user_context("existing_key")
await manager.get_user_context("existing_key")
# Should use the same manager instance
assert manager._user_managers["existing_key"] is manager._user_managers["existing_key"]
@ -36,9 +36,9 @@ class TestMultiUserSessionManager:
@pytest.mark.asyncio
async def test_multiple_api_keys_get_separate_managers(self, manager):
"""Test that different API keys get separate session managers."""
context1 = await manager.get_user_context("key1")
context2 = await manager.get_user_context("key2")
context3 = await manager.get_user_context("key3")
await manager.get_user_context("key1")
await manager.get_user_context("key2")
await manager.get_user_context("key3")
assert len(manager._user_managers) == 3
assert manager._user_managers["key1"] is not manager._user_managers["key2"]
@ -61,7 +61,7 @@ class TestMultiUserSessionManager:
assert session is None
@pytest.mark.asyncio
async def test_login_user_creates_manager_if_not_exists(self, manager):
async def test_login_user_creates_manager_if_not_exists(self):
"""Test that login_user creates a manager if it doesn't exist."""
# This test requires mocking the HTTP client for GeoGuessr API
# We'll mark it as a placeholder for now

View file

@ -1,10 +1,9 @@
"""Tests for UserContext class."""
import pytest
from datetime import UTC, datetime, timedelta
from geoguessr_mcp.auth.session import UserSession
from geoguessr_mcp.auth.user_context import UserContext
from datetime import datetime, timedelta, UTC
class TestUserContext:

View file

@ -11,7 +11,7 @@ feeds, recent games, season statistics, and daily challenges.
import pytest
from geoguessr_mcp.models import Game, SeasonStats, DailyChallenge
from geoguessr_mcp.models import DailyChallenge, Game, SeasonStats
class TestGameService:

View file

@ -9,7 +9,7 @@ operations.
import pytest
from geoguessr_mcp.models import UserProfile, UserStats, Achievement
from geoguessr_mcp.models import Achievement, UserProfile, UserStats
class TestProfileService: