blob: caec55aa832637e7d827c20a3e3b967c129a50cf [file] [log] [blame]
Aleksandra Maciaga6def5972020-02-20 09:42:03 +01001*** Settings ***
2
3Library RequestsLibrary
4Library HttpLibrary.HTTP
5Library Collections
6Resource ../../../common.robot
7Resource ./cert-service-properties.robot
8
9*** Keywords ***
10
11Create 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
16Run 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
22Send 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
31Validate 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}