release: nexus btpanel session fix and app-v2

This commit is contained in:
Codex Release Bot
2026-07-08 22:31:31 +08:00
commit 1933f0af6e
2457 changed files with 350105 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
"""GET /api/settings/{key} defaults when row missing."""
from __future__ import annotations
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from fastapi import HTTPException
from server.api.settings import SETTING_DEFAULTS, get_setting
@pytest.mark.asyncio
async def test_get_push_complete_sound_default_when_missing():
admin = MagicMock()
db = AsyncMock()
with patch("server.api.settings.SettingRepositoryImpl") as repo_cls:
repo_cls.return_value.get = AsyncMock(return_value=None)
out = await get_setting("push_complete_sound", admin=admin, db=db)
assert out["key"] == "push_complete_sound"
assert out["value"] == SETTING_DEFAULTS["push_complete_sound"]
@pytest.mark.asyncio
async def test_get_unknown_key_still_404():
admin = MagicMock()
db = AsyncMock()
with patch("server.api.settings.SettingRepositoryImpl") as repo_cls:
repo_cls.return_value.get = AsyncMock(return_value=None)
with pytest.raises(HTTPException) as exc:
await get_setting("nonexistent_setting_key", admin=admin, db=db)
assert exc.value.status_code == 404