From 312b08c5f3fdca669b2ad92cb41bb54a00967d22 Mon Sep 17 00:00:00 2001 From: Hans Kallekleiv <16436291+HansKallekleiv@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:04:15 +0200 Subject: [PATCH] wip --- .../timeseries/test_get_vector_list.py | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/backend_py/primary/tests/integration/routers/timeseries/test_get_vector_list.py b/backend_py/primary/tests/integration/routers/timeseries/test_get_vector_list.py index a3502c7ae..dcd40b1cd 100644 --- a/backend_py/primary/tests/integration/routers/timeseries/test_get_vector_list.py +++ b/backend_py/primary/tests/integration/routers/timeseries/test_get_vector_list.py @@ -21,10 +21,42 @@ async def test_get_vector_list(test_user, sumo_test_ensemble_ahm): res = client.post("/search", json={}) response = await client.post_async("/search", json={}) - assert 1 == 1 - vector_list = await router.get_vector_list( - None, user, sumo_test_ensemble_ahm.case_uuid, sumo_test_ensemble_ahm.ensemble_name - ) + query_dict = { + "bool": { + "must": [ + {"term": {"class": "table"}}, + {"term": {"_sumo.parent_object.keyword": "485041ce-ad72-48a3-ac8c-484c0ed95cf8"}}, + {"term": {"fmu.iteration.name.keyword": "iter-0"}}, + {"term": {"fmu.context.stage.keyword": "iteration"}}, + {"term": {"fmu.aggregation.operation.keyword": "collection"}}, + {"term": {"data.tagname.keyword": "summary"}}, + {"term": {"data.content.keyword": "timeseries"}}, + ], + } + } + + search_payload = { + "track_total_hits": True, + "query": query_dict, + "aggs": { + "smry_tables": { + "terms": {"field": "data.name.keyword"}, + "aggs": { + "smry_columns": { + "terms": {"field": "data.spec.columns.keyword", "size": 65535}, + }, + }, + }, + }, + "_source": False, + "size": 0, + } + + response = await client.post_async("/search", json=search_payload) + assert response.status_code == 200 + # vector_list = await router.get_vector_list( + # None, user, sumo_test_ensemble_ahm.case_uuid, sumo_test_ensemble_ahm.ensemble_name + # ) - assert len(vector_list) == 786 - assert isinstance(vector_list[0], schemas.VectorDescription) + # assert len(vector_list) == 786 + # assert isinstance(vector_list[0], schemas.VectorDescription)