""" Shared pytest fixtures for channel integration tests. Channel endpoints use their own auth service (token / password) which is separate from the main app JWT auth. When ``auth.token`` and ``auth.password`` in ``channel_config.yaml`` are both empty the channel auth service accepts every request – this is the default dev setup. """ from __future__ import annotations import os import pytest CHANNEL_AUTH_TOKEN = os.getenv("CHANNEL_AUTH_TOKEN", "") CHANNEL_AUTH_PASSWORD = os.getenv("CHANNEL_AUTH_PASSWORD", "") @pytest.fixture() def channel_auth_headers() -> dict[str, str]: if CHANNEL_AUTH_TOKEN: return {"Authorization": f"Bearer {CHANNEL_AUTH_TOKEN}"} if CHANNEL_AUTH_PASSWORD: import base64 encoded = base64.b64encode(f"mgmt:{CHANNEL_AUTH_PASSWORD}".encode()).decode() return {"Authorization": f"Basic {encoded}"} return {}