Add CSIT tests for AAF Cert Service
[integration/csit.git] / tests / aaf / certservice / resources / cert-service-keywords.robot
1 *** Settings ***
2
3 Library               RequestsLibrary
4 Library           HttpLibrary.HTTP
5 Library           Collections
6 Resource          ../../../common.robot
7 Resource          ./cert-service-properties.robot
8
9 *** Keywords ***
10
11 Create sessions
12     [Documentation]  Create all required sessions
13     Create Session    aaf_cert_service_url    ${AAFCERT_URL}
14     Set Suite Variable    ${http_session}    aaf_cert_service_url
15
16 Run Healthcheck
17     [Documentation]  Run Healthcheck
18     ${resp}=    Get Request     ${http_session}         /actuator/health
19     Should Be Equal As Strings  ${resp.status_code}     200
20     Validate Recieved Response  ${resp}  status  UP
21
22 Send Request And Validate Response
23     [Documentation]   Send request to passed url and validate received response
24     [Arguments]   ${path}  ${csr_file}  ${pk_file}  ${resp_code}
25     ${csr}=  Get Data From File  ${csr_file}
26     ${pk}=   Get Data From File  ${pk_file}
27     ${headers}=  Create Dictionary  CSR=${csr}  PK=${pk}
28     ${resp}=    Get Request     ${http_session}  ${path}  headers=${headers}
29     Should Be Equal As Strings  ${resp.status_code}     ${resp_code}
30
31 Validate Recieved Response
32     [Documentation]  Validare message that has been received
33     [Arguments]  ${resp}  ${key}  ${expected_value}
34     ${json}=    Parse Json      ${resp.content}
35     ${value}=  get from dictionary  ${json}  ${key}
36     Should Be Equal As Strings    ${value}    ${expected_value}