ForcePilot/backend/test/integration/channel/test_config_reload_router.py

40 lines
1.5 KiB
Python
Raw Normal View History

"""
Integration tests for channel config reload endpoint (/channel/config/reload).
"""
from __future__ import annotations
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.integration]
async def test_config_reload_returns_reloaded(test_client, channel_auth_headers):
response = await test_client.post("/channel/config/reload", headers=channel_auth_headers)
if response.status_code == 503:
pytest.skip("Channel gateway not initialized")
assert response.status_code == 200, response.text
payload = response.json()
assert payload["status"] == "reloaded"
assert "updated_middlewares" in payload
async def test_config_reload_response_has_config_hash(test_client, channel_auth_headers):
response = await test_client.post("/channel/config/reload", headers=channel_auth_headers)
if response.status_code == 503:
pytest.skip("Channel gateway not initialized")
assert response.status_code == 200, response.text
payload = response.json()
assert "config_hash" in payload
async def test_config_reload_idempotent(test_client, channel_auth_headers):
first = await test_client.post("/channel/config/reload", headers=channel_auth_headers)
if first.status_code == 503:
pytest.skip("Channel gateway not initialized")
assert first.status_code == 200
second = await test_client.post("/channel/config/reload", headers=channel_auth_headers)
assert second.status_code == 200
assert second.json()["status"] == "reloaded"