diff --git a/tests/robot/COMPOSITION_TESTS/CREATE_COMPO_2/create_composition_fail_nodes_not_in_template.robot b/tests/robot/COMPOSITION_TESTS/CREATE_COMPO_2/create_composition_fail_nodes_not_in_template.robot new file mode 100644 index 00000000..1ff23e94 --- /dev/null +++ b/tests/robot/COMPOSITION_TESTS/CREATE_COMPO_2/create_composition_fail_nodes_not_in_template.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Validation test suite +... ${\n}Covers fix provided in: +... https://github.com/ehrbase/ehrbase/pull/1424 +Metadata TOP_TEST_SUITE COMPOSITION + +Resource ../../_resources/keywords/composition_keywords.robot +Resource ../../_resources/keywords/admin_keywords.robot +Resource ../../_resources/keywords/template_opt1.4_keywords.robot + +Suite Setup Set Library Search Order For Tests + + +*** Variables *** +${opt_file} nodes_in_template_invalid.opt +${composition_file} nodes_in_template_invalid__compo.json +${template_id} nodes_in_template_invalid + + +*** Test Cases *** +Create Composition Fails If Nodes Are Not Present In Template + [Tags] Negative + Upload OPT all_types/nodes_in_template_invalid.opt + create EHR + commit composition format=CANONICAL_JSON + ... composition=${composition_file} + Should Be Equal As Strings ${response.status_code} 422 + Should Be Equal As Strings ${response.json()['error']} Unprocessable Entity + Should Contain ${response.json()['message']} not in template + [Teardown] Run Keywords + ... (admin) delete ehr AND + ... Delete Template Using API \ No newline at end of file diff --git a/tests/robot/_resources/test_data_sets/aql/data_load/compositions/external/datetime_tests.json b/tests/robot/_resources/test_data_sets/compositions/CANONICAL_JSON/nodes_in_template_invalid__compo.json similarity index 99% rename from tests/robot/_resources/test_data_sets/aql/data_load/compositions/external/datetime_tests.json rename to tests/robot/_resources/test_data_sets/compositions/CANONICAL_JSON/nodes_in_template_invalid__compo.json index 2bfe5515..87fcd22d 100644 --- a/tests/robot/_resources/test_data_sets/aql/data_load/compositions/external/datetime_tests.json +++ b/tests/robot/_resources/test_data_sets/compositions/CANONICAL_JSON/nodes_in_template_invalid__compo.json @@ -12,7 +12,7 @@ }, "template_id": { "_type": "TEMPLATE_ID", - "value": "test_all_types.en.v1" + "value": "nodes_in_template_invalid" }, "rm_version": "1.0.2" }, diff --git a/tests/robot/_resources/test_data_sets/aql/data_load/opts/external/test_all_types.opt b/tests/robot/_resources/test_data_sets/valid_templates/all_types/nodes_in_template_invalid.opt similarity index 99% rename from tests/robot/_resources/test_data_sets/aql/data_load/opts/external/test_all_types.opt rename to tests/robot/_resources/test_data_sets/valid_templates/all_types/nodes_in_template_invalid.opt index 88f793d0..45f09be0 100644 --- a/tests/robot/_resources/test_data_sets/aql/data_load/opts/external/test_all_types.opt +++ b/tests/robot/_resources/test_data_sets/valid_templates/all_types/nodes_in_template_invalid.opt @@ -36,9 +36,9 @@ 4c0d4207-562f-41d8-bbdd-3ef8b69edf61 - test_all_types.en.v1 + nodes_in_template_invalid - Test all types + Nodes in template invalid COMPOSITION @@ -2871,7 +2871,7 @@ openEHR-EHR-COMPOSITION.test_all_types.v1 - test_all_types.en.v1 + nodes_in_template_invalid unknown