From ae8332dc3d43aba67c494fa33f0c4386e405f680 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 27 Jul 2026 23:10:01 +0200 Subject: [PATCH] (dashboard) fix pytest --- service/src/main/inse/dashboard/test_service.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/service/src/main/inse/dashboard/test_service.py b/service/src/main/inse/dashboard/test_service.py index 250f2e09..df9f6e62 100644 --- a/service/src/main/inse/dashboard/test_service.py +++ b/service/src/main/inse/dashboard/test_service.py @@ -8,6 +8,9 @@ from sqlmodel import Session, SQLModel, create_engine from inse import config from inse.auth.model import AccessToken, Organization, UserRole +from inse.authors.institution_membership_query import ( + build_active_institution_membership_query, +) from inse.dashboard.service import ( get_dashboard_bmbf_project_statuses, get_dashboard_organization, @@ -232,11 +235,9 @@ async def test_dashboard_statistics_counts_organization_data_and_all_projects(): assert works_call.kwargs["query"]["nested"]["query"]["term"] == { "authorships.institutions.id": ORG_INSTITUTION_ID } - assert authors_call.kwargs["query"]["bool"]["should"][0]["bool"]["filter"][ - 0 - ]["nested"]["query"]["match_phrase"] == { - "last_known_institutions.id": ORG_INSTITUTION_ID - } + assert authors_call.kwargs["query"] == build_active_institution_membership_query( + ORG_INSTITUTION_ID + ) assert all( call.kwargs["cluster"] == ESCluster.INSE for call in [eu_call, bmbf_call, *dfg_calls]