"""Tests for `raycast_api.ai.me.MeAPI`. Trivial endpoint — verify the unsigned GET goes to the right URL and the response is returned as a raw dict. """ from __future__ import annotations from typing import Any import pytest from aioresponses import aioresponses from raycast_api.client import Client from raycast_api.config import Config from raycast_api.signing_spec import RotRange, SigningSpec def _config() -> Config: return Config( signature_secret="0" * 64, signing_spec=SigningSpec( rot_fn_name="Sur", signing_fn_name="Nkt", rot_ranges=[ RotRange(start=65, end=90, shift=13), RotRange(start=97, end=122, shift=13), RotRange(start=48, end=57, shift=5), ], ), app_version="0.60.1.0", user_agent="Raycast/0.60.1.0 (x-macOS Version 26.3.1)", bundle_hash="0" * 64, launcher_hash="0" * 64, ) class TestMeAPI: @pytest.mark.asyncio async def test_get_returns_dict_and_does_not_sign(self) -> None: captured: dict[str, Any] = {} def _cb(url: Any, **kwargs: Any) -> Any: captured["headers"] = dict(kwargs.get("headers") or {}) from aioresponses import CallbackResult return CallbackResult( status=200, payload={ "id": "u_1", "email": "alice@example.com", "has_pro_features": True, }, ) with aioresponses() as mocked: mocked.get("https://backend.raycast.com/api/v1/me", callback=_cb) client = Client( config=_config(), bearer_token="rca_test", device_id="a" * 64 ) async with client: me = await client.me.get() assert me["email"] == "alice@example.com" assert me["has_pro_features"] is True assert "X-Raycast-Signature-v2" not in captured["headers"] assert captured["headers"]["Authorization"] == "Bearer rca_test"