From 6af8490276131fc1d2f61e001d0a8631bddd0508 Mon Sep 17 00:00:00 2001 From: luxferre Date: Tue, 9 Jun 2026 16:06:28 +0100 Subject: [PATCH 1/2] fix: wrong contact email in new endpoint --- src/user/router.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/user/router.py b/src/user/router.py index f5ec0a7..0a37d6f 100644 --- a/src/user/router.py +++ b/src/user/router.py @@ -134,7 +134,7 @@ async def get_user_orgs(user_model: user_model_claims_dependency): "root_user_email": org.root_user_email, "billing_contact": { "id": org.billing_contact_id, - "email": org.owner_contact_rel.email, + "email": org.billing_contact_rel.email, }, "owner_contact": { "id": org.owner_contact_id, From f0eaff2073af95aa37d53ed905d107cd3287b46b Mon Sep 17 00:00:00 2001 From: luxferre Date: Tue, 9 Jun 2026 16:06:53 +0100 Subject: [PATCH 2/2] tests: get self orgs --- test/test_user.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/test_user.py b/test/test_user.py index 31fd2bb..c86914d 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -111,3 +111,35 @@ async def test_post_user_invitation_accept_status_checks( if resp.status_code == 401: assert resp.json()["detail"] == "Invalid JWS" + + +@pytest.mark.anyio +async def test_get_self_orgs_success(default_client: AsyncClient): + resp = await default_client.get("/user/self/orgs") + assert resp.status_code == 200 + + data = resp.json() + + assert "organisations" in data + assert isinstance(data["organisations"], list) + assert len(data["organisations"]) > 0 + + org = data["organisations"][0] + assert org["organisation_id"] == 1 + assert org["name"] == "Test Org" + assert org["status"] == "approved" + assert org["root_user_email"] == "admin@test.com" + assert "intake_questionnaire" in org + assert isinstance(org["intake_questionnaire"], dict) + + assert isinstance(org["billing_contact"], dict) + assert org["billing_contact"]["email"] == "billing@test.org" + assert org["billing_contact"]["id"] == 1 + + assert isinstance(org["owner_contact"], dict) + assert org["owner_contact"]["email"] == "owner@test.org" + assert org["owner_contact"]["id"] == 2 + + assert isinstance(org["security_contact"], dict) + assert org["security_contact"]["email"] == "security@test.org" + assert org["security_contact"]["id"] == 3