- Profiler: UserProfile.note (nullable, startup migration), PUT
/profiles/{id}/note (max 1000 chars); add missing `requests`
dependency (client creation failed without Public IP set).
- UI: clickable rows on Certificates open a compact profile details
modal with an editable note; tooltip with the note on the client
name (v-note-tooltip) and a note icon.
- PKI init runs in a background thread: POST /system/init returns 202,
GET /system/init/status, 409 for a second start, Clear PKI and client
creation are blocked while it runs. A marker file identifies an
interrupted run (only such a PKI is wiped on the next Init).
- PKI Configuration page: state from the server, progress spinner and
step text, polling, Init/Clear/Save locked while running, Init locked
once initialized.
- Tests: one pytest each for notes and async init (requirements-dev.txt).
- Docs: plans and summaries in DOCS/Changes, API reference, README, Index.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
33 lines
986 B
Python
33 lines
986 B
Python
import os
|
|
import tempfile
|
|
|
|
# The DB path must be set before database.py is imported (via main)
|
|
_tmp = tempfile.TemporaryDirectory()
|
|
os.environ["OVPMON_PROFILER_DB_PATH"] = os.path.join(_tmp.name, "test.db")
|
|
|
|
from fastapi.testclient import TestClient
|
|
from main import app
|
|
from database import SessionLocal
|
|
from models import UserProfile
|
|
from utils.auth import verify_token
|
|
|
|
app.dependency_overrides[verify_token] = lambda: {"sub": "test"}
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_put_note_is_stored_and_listed():
|
|
db = SessionLocal()
|
|
profile = UserProfile(username="note-user", status="active")
|
|
db.add(profile)
|
|
db.commit()
|
|
profile_id = profile.id
|
|
db.close()
|
|
|
|
res = client.put(f"/api/profiles/{profile_id}/note", json={"note": "hello"})
|
|
assert res.status_code == 200
|
|
assert res.json()["note"] == "hello"
|
|
|
|
res = client.get("/api/profiles")
|
|
assert res.status_code == 200
|
|
assert [p["note"] for p in res.json() if p["id"] == profile_id] == ["hello"]
|