From 714039c39e418eacd1f3151fc846cb2dd7d82184 Mon Sep 17 00:00:00 2001 From: vladislavploaia Date: Wed, 2 Oct 2024 17:58:06 +0300 Subject: [PATCH] fix: adjust test case for select f from Folder f --- ...ultiple_ehrs_and_compo_select_by_ids.robot | 2 - .../f_from_folder_f.robot | 36 ++++ .../combinations/select_paths_in_folder.csv | 9 +- .../expected_folder_find_by_ehr_id.json | 2 +- ...multiple_ehrs_and_compo_select_by_ids.json | 31 ++++ .../expected_select_paths_in_folder_f.json | 166 ------------------ 6 files changed, 72 insertions(+), 174 deletions(-) create mode 100644 tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/f_from_folder_f.robot delete mode 100644 tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_select_paths_in_folder_f.json diff --git a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/multiple_ehrs_and_compo_select_by_ids.robot b/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/multiple_ehrs_and_compo_select_by_ids.robot index 4889d345..412418aa 100644 --- a/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/multiple_ehrs_and_compo_select_by_ids.robot +++ b/tests/robot/AQL_TESTS/FOLDER/FROM_FOLDER_CONTAINS_COMPO/multiple_ehrs_and_compo_select_by_ids.robot @@ -22,8 +22,6 @@ Suite Teardown Run Keywords Admin Delete EHR For AQL ${ehr_id1} AND *** Test Cases *** SELECT e/ehr_id/value, f/uid/value, c/uid/value FROM EHR e CONTAINS FOLDER f CONTAINS COMPOSITION c WHERE e/ehr_id/value = '${ehr_id2}' AND f/uid/value = '70939d97-8add-4419-b27c-516e64b1c744' AND c/uid/value = '${c_uid4b}' - [Tags] not-ready - Log Skipped as returns emtpy rows. console=yes ${query} Set Variable ... SELECT e/ehr_id/value, f/uid/value, c/uid/value FROM EHR e CONTAINS FOLDER f CONTAINS COMPOSITION c WHERE e/ehr_id/value = '${ehr_id2}' AND f/uid/value = '70939d97-8add-4419-b27c-516e64b1c744' AND c/uid/value = '${c_uid4b}' Set AQL And Execute Ad Hoc Query ${query} diff --git a/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/f_from_folder_f.robot b/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/f_from_folder_f.robot new file mode 100644 index 00000000..1d6cb03b --- /dev/null +++ b/tests/robot/AQL_TESTS/FOLDER/SELECT_PATHS_IN_FOLDER/f_from_folder_f.robot @@ -0,0 +1,36 @@ +*** Settings *** +Documentation CHECK SELECT PATHS IN FOLDER +... - Covers: https://github.com/ehrbase/conformance-testing-documentation/blob/main/FOLDER.md#select-paths-in-folder +... - *Precondition:* +... - 1. Create EHR; +... - 2. Create Directory with folder_details.json; +... - Send AQL 'SELECT f FROM FOLDER f' query and compare response body with expected file content. +... - *Postcondition:* Delete EHR using ADMIN endpoint. +Resource ../../../_resources/keywords/aql_keywords.robot + +Suite Setup Precondition +Suite Teardown Admin Delete EHR For AQL + + +*** Variables *** +${q} SELECT f FROM FOLDER f + + +*** Test Cases *** +1. SELECT f FROM FOLDER f + Set Test Variable ${query} ${q} + Set AQL And Execute Ad Hoc Query ${query} + Length Should Be ${resp_body['rows']} 2 + Dictionary Should Contain Key ${resp_body['rows'][0][0]} name + Dictionary Should Contain Key ${resp_body['rows'][0][0]} archetype_node_id + Dictionary Should Contain Key ${resp_body['rows'][0][0]} details + Dictionary Should Contain Key ${resp_body['rows'][0][0]} uid + Should Be Equal As Strings ${resp_body['rows'][0][0]['_type']} FOLDER + Should Be Equal As Strings ${resp_body['rows'][1][0]['_type']} FOLDER + + +*** Keywords *** +Precondition + Set Library Search Order For Tests + Create EHR For AQL + Create Directory For AQL folder_details.json has_robot_vars=${FALSE} diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/combinations/select_paths_in_folder.csv b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/combinations/select_paths_in_folder.csv index e60f5475..044e56b8 100644 --- a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/combinations/select_paths_in_folder.csv +++ b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/combinations/select_paths_in_folder.csv @@ -1,6 +1,5 @@ ${query_nr},${path},${expected_file},${nr_of_results} -1.,f,expected_select_paths_in_folder_f.json,2 -2.,f/items/id/value,expected_select_paths_in_folder_items_id_value.json,3 -3.,f/items,expected_select_paths_in_folder_f_items.json,3 -4.,f/details,expected_select_paths_in_folder_f_details.json,2 -5.,f/details[at0003]/items[at0004]/value/value,expected_select_paths_in_folder_f_details_at4_val.json,2 \ No newline at end of file +1.,f/items/id/value,expected_select_paths_in_folder_items_id_value.json,3 +2.,f/items,expected_select_paths_in_folder_f_items.json,3 +3.,f/details,expected_select_paths_in_folder_f_details.json,2 +4.,f/details[at0003]/items[at0004]/value/value,expected_select_paths_in_folder_f_details_at4_val.json,2 \ No newline at end of file diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_ehr_id.json b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_ehr_id.json index e7949d18..9c0b429e 100644 --- a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_ehr_id.json +++ b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_folder_find_by_ehr_id.json @@ -20,7 +20,7 @@ "rows": [ [ "${ehr_id1}", - "00e952ca-a5b2-4f24-8d37-59240fd37020::local.ehrbase.org::1" + "60e952ca-a5b2-4f24-8d37-59240fd37020::local.ehrbase.org::1" ], [ "${ehr_id1}", diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_multiple_ehrs_and_compo_select_by_ids.json b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_multiple_ehrs_and_compo_select_by_ids.json index e69de29b..5f1389d0 100644 --- a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_multiple_ehrs_and_compo_select_by_ids.json +++ b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_multiple_ehrs_and_compo_select_by_ids.json @@ -0,0 +1,31 @@ +{ + "meta": { + "_type": "RESULTSET", + "_schema_version": "1.0.3", + "_created": "2024-10-02T17:22:48.3197573+03:00", + "_executed_aql": "SELECT e/ehr_id/value, f/uid/value, c/uid/value FROM EHR e CONTAINS FOLDER f CONTAINS COMPOSITION c WHERE (e/ehr_id/value = '2fd7ff0d-78e7-487f-b31e-e9a25a83e442' AND f/uid/value = '70939d97-8add-4419-b27c-516e64b1c744' AND c/uid/value = 'c599d95d-f258-4f95-9b99-122fc049f5f0')", + "resultsize": 1 + }, + "q": "SELECT e/ehr_id/value, f/uid/value, c/uid/value FROM EHR e CONTAINS FOLDER f CONTAINS COMPOSITION c WHERE e/ehr_id/value = '2fd7ff0d-78e7-487f-b31e-e9a25a83e442' AND f/uid/value = '70939d97-8add-4419-b27c-516e64b1c744' AND c/uid/value = 'c599d95d-f258-4f95-9b99-122fc049f5f0'", + "columns": [ + { + "path": "e/ehr_id/value", + "name": "#0" + }, + { + "path": "f/uid/value", + "name": "#1" + }, + { + "path": "c/uid/value", + "name": "#2" + } + ], + "rows": [ + [ + "${ehr_id2}", + "70939d97-8add-4419-b27c-516e64b1c744", + "${c_uid4b}::local.ehrbase.org::1" + ] + ] +} \ No newline at end of file diff --git a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_select_paths_in_folder_f.json b/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_select_paths_in_folder_f.json deleted file mode 100644 index 8c6f8b5f..00000000 --- a/tests/robot/_resources/test_data_sets/aql/fields_and_results/folder/expected_select_paths_in_folder_f.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "meta": { - "_type": "RESULTSET", - "_schema_version": "1.0.3", - "_created": "2024-09-19T17:43:55.2385056+03:00", - "_executed_aql": "SELECT f FROM FOLDER f", - "resultsize": 2 - }, - "q": "SELECT f FROM FOLDER f", - "columns": [ - { - "path": "f", - "name": "#0" - } - ], - "rows": [ - [ - { - "_type": "FOLDER", - "name": { - "_type": "DV_TEXT", - "value": "root1" - }, - "folders": [ - { - "_type": "FOLDER", - "name": { - "_type": "DV_TEXT", - "value": "subfolder1" - }, - "items": [ - { - "_type": "OBJECT_REF", - "namespace": "my.system.id", - "type": "VERSIONED_COMPOSITION", - "id": { - "_type": "HIER_OBJECT_ID", - "value": "7c0a9df0-564f-4f34-8e65-92586c64ef56" - } - }, - { - "_type": "OBJECT_REF", - "namespace": "my.system.id", - "type": "VERSIONED_COMPOSITION", - "id": { - "_type": "HIER_OBJECT_ID", - "value": "c68131a3-72da-41fe-8d11-c4fccfd2d2d0" - } - } - ], - "details": { - "_type": "ITEM_TREE", - "name": { - "_type": "DV_TEXT", - "value": "Tree" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "text" - }, - "value": { - "_type": "DV_TEXT", - "value": "value1" - }, - "archetype_node_id": "at0004" - } - ], - "archetype_node_id": "at0003" - }, - "archetype_node_id": "openEHR-EHR-FOLDER.episode_of_care.v1", - "uid": { - "_type": "HIER_OBJECT_ID", - "value": "8a6d7c34-4a6e-481a-ae57-f1a7ef63840d" - } - } - ], - "details": { - "_type": "ITEM_TREE", - "name": { - "_type": "DV_TEXT", - "value": "Tree" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "text" - }, - "value": { - "_type": "DV_TEXT", - "value": "value2" - }, - "archetype_node_id": "at0004" - } - ], - "archetype_node_id": "at0003" - }, - "archetype_node_id": "openEHR-EHR-FOLDER.generic.v1", - "uid": { - "_type": "OBJECT_VERSION_ID", - "value": "1ea40c11-debc-43c5-8c03-dbcf72bc073c::local.ehrbase.org::1" - } - } - ], - [ - { - "_type": "FOLDER", - "name": { - "_type": "DV_TEXT", - "value": "subfolder1" - }, - "items": [ - { - "_type": "OBJECT_REF", - "namespace": "my.system.id", - "type": "VERSIONED_COMPOSITION", - "id": { - "_type": "HIER_OBJECT_ID", - "value": "7c0a9df0-564f-4f34-8e65-92586c64ef56" - } - }, - { - "_type": "OBJECT_REF", - "namespace": "my.system.id", - "type": "VERSIONED_COMPOSITION", - "id": { - "_type": "HIER_OBJECT_ID", - "value": "c68131a3-72da-41fe-8d11-c4fccfd2d2d0" - } - } - ], - "details": { - "_type": "ITEM_TREE", - "name": { - "_type": "DV_TEXT", - "value": "Tree" - }, - "items": [ - { - "_type": "ELEMENT", - "name": { - "_type": "DV_TEXT", - "value": "text" - }, - "value": { - "_type": "DV_TEXT", - "value": "value1" - }, - "archetype_node_id": "at0004" - } - ], - "archetype_node_id": "at0003" - }, - "archetype_node_id": "openEHR-EHR-FOLDER.episode_of_care.v1", - "uid": { - "_type": "HIER_OBJECT_ID", - "value": "8a6d7c34-4a6e-481a-ae57-f1a7ef63840d" - } - } - ] - ] -} \ No newline at end of file