# Copyright (c) 2019 Wladislaw Wagner (Vitasystems GmbH), Pablo Pazos (Hannover Medical School). # # This file is part of Project EHRbase # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. *** Settings *** Metadata Version 0.1.0 Metadata Authors *Wladislaw Wagner*, *Pablo Pazos* Metadata Created 2019.03.10 Documentation I_EHR_SERVICE.create_ehr-main: Create new EHR Metadata TOP_TEST_SUITE EHR_SERVICE Resource ../../_resources/keywords/ehr_keywords.robot # Suite Setup startup SUT # Suite Teardown shutdown SUT Force Tags refactor Library REST *** Test Cases *** #/////////////////////////////////////////////// # // # CASES WITH VALID DATA SETS // # // #/////////////////////////////////////////////// 001 - Create EHR (Valid Data Sets) [Documentation] Create EHR providing a valid payload as input.\n\n ... Check https://github.com/ehrbase/ehrbase/blob/develop/doc/conformance_testing/EHR.md#b1-create-ehr ... for more details. [Tags] [Template] Create EHR From Valid Data Set #No. is_queryable is_modifiable subject other_details ehr_id 1 true true provided not provided not provided 2 true false provided not provided not provided 3 false true provided not provided not provided 4 false false provided not provided not provided 5 true true provided provided not provided 6 true false provided provided not provided 7 false true provided provided not provided 8 false false provided provided not provided 9 true true provided not provided provided 10 true false provided not provided provided 11 false true provided not provided provided 12 false false provided not provided provided 13 true true provided provided provided 14 true false provided provided provided 15 false true provided provided provided 16 false false provided provided provided MF-019 - Create new EHR (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_TREE [Tags] prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/002_ehr_status_with_other_details_item_tree.json POST /ehr ${body} Integer response status 201 ${actual_ehr_status}= Object response body ehr_status Set Test Variable ${expected_ehr_status} ${body} ${exclude_paths} Create List root['uid'] root['name']['_type'] root['subject']['_type'] &{diff}= compare json-strings ${actual_ehr_status}[0] ${expected_ehr_status} ... exclude_paths=${exclude_paths} Log To Console \n\n&{diff} Should Be Empty ${diff} msg=DIFF DETECTED! MF-020 - Create new EHR (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_LIST [Tags] prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/003_ehr_status_with_other_details_item_list.json POST /ehr ${body} Integer response status 201 ${actual_ehr_status}= Object response body ehr_status Set Test Variable ${expected_ehr_status} ${body} ${exclude_paths} Create List root['uid'] root['name']['_type'] root['subject']['_type'] &{diff}= compare json-strings ${actual_ehr_status}[0] ${expected_ehr_status} ... exclude_paths=${exclude_paths} Should Be Empty ${diff} msg=DIFF DETECTED! MF-021 - Create new EHR (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_SINGLE [Tags] prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/004_ehr_status_with_other_details_item_single.json POST /ehr ${body} Integer response status 201 MF-022 - Create new EHR (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_TABLE [Tags] 162 not-ready prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/005_ehr_status_with_other_details_item_table.json POST /ehr ${body} TRACE GITHUB ISSUE 162 bug Integer response status 201 MF-051 - Create new EHR providing an ehr_id (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_TREE [Tags] prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/002_ehr_status_with_other_details_item_tree.json PUT /ehr/ehr_id body=${body} Integer response status 201 ${actual_ehr_status}= Object response body ehr_status Set Test Variable ${expected_ehr_status} ${body} ${exclude_paths} Create List root['uid'] root['name']['_type'] root['subject']['_type'] &{diff}= compare json-strings ${actual_ehr_status}[0] ${expected_ehr_status} ... exclude_paths=${exclude_paths} Should Be Empty ${diff} msg=DIFF DETECTED! MF-052 - Create new EHR providing an ehr_id (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_LIST [Tags] prepare new request session JSON ${body}= randomize subject_id in test-data-set valid/003_ehr_status_with_other_details_item_list.json PUT /ehr/ehr_id body=${body} Integer response status 201 ${actual_ehr_status}= Object response body ehr_status Set Test Variable ${expected_ehr_status} ${body} ${exclude_paths} Create List root['uid'] root['name']['_type'] root['subject']['_type'] &{diff}= compare json-strings ${actual_ehr_status}[0] ${expected_ehr_status} ... exclude_paths=${exclude_paths} Should Be Empty ${diff} msg=DIFF DETECTED! MF-053 - Create new EHR providing an ehr_id (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_SINGLE [Tags] prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/004_ehr_status_with_other_details_item_single.json PUT /ehr/ehr_id body=${body} Integer response status 201 MF-054 - Create new EHR providing an ehr_id (valid ehr_status with other_details) [Documentation] Covers happy path with "other_details" _type ITEM_TABLE [Tags] 162 not-ready prepare new request session JSON Prefer=return=representation ${body}= randomize subject_id in test-data-set valid/005_ehr_status_with_other_details_item_table.json PUT /ehr/ehr_id body=${body} TRACE GITHUB ISSUE 162 bug Integer response status 201 #/////////////////////////////////////////////// # // # CASES WITH DIFFERENT REQUEST HEADERS // # // #/////////////////////////////////////////////// 002 - POST /ehr (no accept header, content-type=xml) prepare new request session no accept header xml Prefer=${None} create supernew ehr ehr_keywords.validate POST response - 204 no content 003 - POST /ehr (no content header) prepare new request session no content header Prefer=${None} create supernew ehr ehr_keywords.validate POST response - 204 no content 004 - POST /ehr (no accept/content-type headers) prepare new request session no accept/content headers Prefer=${None} create supernew ehr ehr_keywords.validate POST response - 204 no content 005 - POST /ehr (no headers) prepare new request session no headers Prefer=WLADISLAW create supernew ehr ehr_keywords.validate POST response - 204 no content MF-001 - Create new EHR (without Prefer header) [Tags] prepare new request session JSON Prefer=${None} create supernew ehr ehr_keywords.validate POST response - 204 no content MF-001a - Create new EHR (without Prefer and Accept header) [Tags] prepare new request session no accept header Prefer=${None} create supernew ehr ehr_keywords.validate POST response - 204 no content MF-002 - Create new EHR (Prefer header: minimal) [Tags] [Documentation] This test should behave equqly to MF-001 prepare new request session JSON Prefer=return=minimal create supernew ehr ehr_keywords.validate POST response - 204 no content MF-003 - Create new EHR (XML, Prefer header: minimal) [Tags] prepare new request session XML Prefer=return=minimal # create new EHR (XML) create supernew ehr ehr_keywords.validate POST response - 204 no content MF-005 - Create new EHR (XML, Prefer header: representation) [tags] EHR_STATUS_create_xml prepare new request session XML Prefer=return=representation create new EHR (XML) # comment: check steps String response body pattern= # String response body pattern=EHR Status # String response body pattern=EHR Status