Update DFG project test
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
spsaefan
2026-07-22 23:46:23 +02:00
parent 59a1f765d0
commit fc134dad8e
@@ -9,6 +9,7 @@ from sqlmodel import Session, SQLModel, create_engine
from inse import config
from inse.auth.model import AccessToken, Organization, UserRole
from inse.dashboard.service import (
DFG_INSTITUTION_FIELDS,
get_dashboard_organization,
get_dashboard_statistics,
get_top_authors,
@@ -230,18 +231,35 @@ async def test_top_authors_maps_works_and_dfg_project_aggregations():
for call in mocked_search.await_args_list
if call.kwargs["index"] == ESIndex.DFG_PROJECTS
]
assert len(dfg_project_calls) == 1
assert dfg_project_calls[0].kwargs["body"]["_source"] == [
"id",
"project_id",
"persons",
"id",
"project_id",
"persons",
*DFG_INSTITUTION_FIELDS,
]
assert dfg_project_calls[0].kwargs["body"]["query"] == {
"nested": {
"path": "persons",
"query": {"terms": {"persons.person_id": [2]}},
}
query = dfg_project_calls[0].kwargs["body"]["query"]
assert query["bool"]["must"][0]["bool"]["minimum_should_match"] == 1
assert query["bool"]["must"][0]["bool"]["should"][0]["bool"]["should"][0][
"match"
] == {
"Antragstellende Institution": {
"query": "Example Org",
"operator": "and",
}
}
assert query["bool"]["must"][1] == {
"nested": {
"path": "persons",
"query": {
"terms": {
"persons.person_id": [2],
}
},
}
}
@pytest.mark.anyio