import pytest from thoughtsync.app import create_app @pytest.fixture def app(): return create_app() async def test_settings_requires_auth(app): # require_admin returns 401 before any DB access when unauthenticated. client = app.test_client() resp = await client.get("/api/settings") assert resp.status_code == 401 async def test_settings_patch_requires_auth(app): client = app.test_client() resp = await client.patch("/api/settings", json={"site_name": "x"}) assert resp.status_code == 401