diff --git a/src/ert_storage/graphql/responses.py b/src/ert_storage/graphql/responses.py index 8154009a..2668aa5b 100644 --- a/src/ert_storage/graphql/responses.py +++ b/src/ert_storage/graphql/responses.py @@ -1,4 +1,5 @@ -from typing import List, Optional, TYPE_CHECKING +from enum import Enum +from typing import Any, List, Optional, TYPE_CHECKING import graphene as gr from ert_storage.ext.graphene_sqlalchemy import SQLAlchemyObjectType @@ -14,6 +15,10 @@ class Meta: model = ds.Record name = gr.String() + record_type = gr.Enum.from_enum(ds.RecordType) def resolve_name(root: ds.Record, info: "ResolveInfo") -> str: return root.name + + def resolve_record_type(root: ds.Record, info: "ResolveInfo") -> Enum: + return root.record_info.record_type diff --git a/tests/integration/gql/test_responses.py b/tests/integration/gql/test_responses.py index 0ed3454d..abd21155 100644 --- a/tests/integration/gql/test_responses.py +++ b/tests/integration/gql/test_responses.py @@ -7,6 +7,7 @@ ensemble(id: $id) { uniqueResponses { name + recordType } } } @@ -73,6 +74,7 @@ def test_get_gql_response(client, create_experiment, create_ensemble): r = client.gql_execute(GET_UNIQUE_RESPONSES, variable_values={"id": ensemble_id}) for response in r["data"]["ensemble"]["uniqueResponses"]: assert response["name"] in RESPONSE_NAMES + assert response["recordType"] == "F64_MATRIX" # retrieve all responses and realizations r = client.gql_execute(GET_ALL_RESPONSES, variable_values={"id": ensemble_id})