Skip to content

Commit

Permalink
feat: CDR-1429 add Robot test suite for Swagger EHRBase API checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vladislavploaia committed Jun 7, 2024
1 parent fd21e8e commit 83183cf
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/robot/SWAGGER_TESTS/__init__.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2024 Vladislav Ploaia (Vitagroup - CDR Core Team).
#
# 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 ***
Documentation SWAGGER EHRBASE DEFINITIONS TEST SUITE
...
Metadata Author *Vladislav Ploaia*

Resource ${EXECDIR}/robot/_resources/suite_settings.robot

Force Tags SWAGGER_EHRBASE
68 changes: 68 additions & 0 deletions tests/robot/SWAGGER_TESTS/swagger_health_check_tests.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
*** Settings ***
Documentation Test suite to check Swagger EHRBase API availability.
... \nCovers https://vitagroup-ag.atlassian.net/browse/CDR-1429
Resource ${EXECDIR}/robot/_resources/suite_settings.robot
Suite Setup Set Library Search Order For Tests


*** Variables ***
${api_docs_version_part} /v3/api-docs


*** Test Cases ***
1. Check Swagger Main Page Availability
${temp_str} Remove String ${BASEURL} /rest/openehr/v1
Set Suite Variable ${BASEURL} ${temp_str}
Create Session ${SUT} ${BASEURL} verify=True
${resp} GET On Session ${SUT} /swagger-ui/index.html expected_status=anything
Status Should Be 200 ${resp}

2. Check Swagger openEHR API Availability
${resp} GET On Session ${SUT} ${api_docs_version_part}/1. openEHR API expected_status=anything
Status Should Be 200 ${resp}
Dictionary Should Contain Key ${resp.json()} paths
Set Test Variable ${resp_json_paths} ${resp.json()['paths']}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/ehr/{ehr_id}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/query/aql
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/definition/query/{qualified_query_name}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/definition/template/adl1.4
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/ehr/{ehr_id}/versioned_composition/{versioned_object_uid}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/ehr/{ehr_id}/ehr_status/{version_uid}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/ehr/{ehr_id}/directory/{version_uid}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/ehr/{ehr_id}/contribution/{contribution_uid}
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/definition/template/adl1.4/{template_id}/example
Dictionary Should Contain Key ${resp_json_paths} /rest/openehr/v1/definition/query

3. Check Swagger EhrScape API Availability
${resp} GET On Session ${SUT} ${api_docs_version_part}/2. EhrScape API expected_status=anything
Status Should Be 200 ${resp}
Dictionary Should Contain Key ${resp.json()} paths
Set Test Variable ${resp_json_paths} ${resp.json()['paths']}
Dictionary Should Contain Key ${resp_json_paths} /rest/ecis/v1/composition/{uid}
Dictionary Should Contain Key ${resp_json_paths} /rest/ecis/v1/composition
Dictionary Should Contain Key ${resp_json_paths} /rest/ecis/v1/template/{templateId}
Dictionary Should Contain Key ${resp_json_paths} /rest/ecis/v1/template/{templateId}/example

4. Check Swagger EHRbase Status Endpoint
${resp} GET On Session ${SUT} ${api_docs_version_part}/3. EHRbase Status Endpoint expected_status=anything
Status Should Be 200 ${resp}
Dictionary Should Contain Key ${resp.json()} paths
Dictionary Should Contain Key ${resp.json()['paths']} /rest/status

5. Check Swagger EHRbase Admin API
${resp} GET On Session ${SUT} ${api_docs_version_part}/4. EHRbase Admin API expected_status=anything
Status Should Be 200 ${resp}
Dictionary Should Contain Key ${resp.json()} paths
Set Test Variable ${resp_json_paths} ${resp.json()['paths']}
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/template/{template_id}
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/ehr/{ehr_id}
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/ehr/{ehr_id}/contribution/{contribution_id}
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/status
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/template/all
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/query/{qualified_query_name}/{version}
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/ehr/{ehr_id}/directory/{directory_id}
Dictionary Should Contain Key ${resp_json_paths} /rest/admin/ehr/{ehr_id}/composition/{composition_id}

6. Check Swagger Management API
${resp} GET On Session ${SUT} ${api_docs_version_part}/5. Management API expected_status=anything
Status Should Be 200 ${resp}

0 comments on commit 83183cf

Please sign in to comment.