feat(profile): add profile settings and LLM user context

This commit is contained in:
Piotr Oleszczyk 2026-03-05 15:57:21 +01:00
parent db3d9514d5
commit b99b9ed68e
25 changed files with 472 additions and 9 deletions

View file

@ -0,0 +1,35 @@
def test_get_profile_empty(client):
r = client.get("/profile")
assert r.status_code == 200
assert r.json() is None
def test_upsert_profile_create_and_get(client):
create = client.patch(
"/profile", json={"birth_date": "1990-01-15", "sex_at_birth": "male"}
)
assert create.status_code == 200
body = create.json()
assert body["birth_date"] == "1990-01-15"
assert body["sex_at_birth"] == "male"
fetch = client.get("/profile")
assert fetch.status_code == 200
fetched = fetch.json()
assert fetched is not None
assert fetched["id"] == body["id"]
def test_upsert_profile_updates_existing_row(client):
first = client.patch(
"/profile", json={"birth_date": "1992-06-10", "sex_at_birth": "female"}
)
assert first.status_code == 200
first_id = first.json()["id"]
second = client.patch("/profile", json={"sex_at_birth": "intersex"})
assert second.status_code == 200
second_body = second.json()
assert second_body["id"] == first_id
assert second_body["birth_date"] == "1992-06-10"
assert second_body["sex_at_birth"] == "intersex"