Aleksandra Maciaga | 6def597 | 2020-02-20 09:42:03 +0100 | [diff] [blame] | 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 | |
Aleksandra Maciaga | 6def597 | 2020-02-20 09:42:03 +0100 | [diff] [blame] | 22 | Validate Recieved Response |
| 23 | [Documentation] Validare message that has been received |
| 24 | [Arguments] ${resp} ${key} ${expected_value} |
| 25 | ${json}= Parse Json ${resp.content} |
Aleksandra Maciaga | 8d762b1 | 2020-02-24 14:24:42 +0100 | [diff] [blame^] | 26 | ${value}= Get From Dictionary ${json} ${key} |
| 27 | Should Be Equal As Strings ${value} ${expected_value} |
| 28 | |
| 29 | Send Get Request And Validate Response |
| 30 | [Documentation] Send request to passed url and validate received response |
| 31 | [Arguments] ${path} ${resp_code} |
| 32 | ${resp}= Get Request ${http_session} ${path} |
| 33 | Should Be Equal As Strings ${resp.status_code} ${resp_code} |
| 34 | |
| 35 | Send Get Request with Header And Validate Response |
| 36 | [Documentation] Send request to passed url and validate received response |
| 37 | [Arguments] ${path} ${csr_file} ${pk_file} ${resp_code} |
| 38 | ${headers}= Create Header with CSR and PK ${csr_file} ${pk_file} |
| 39 | ${resp}= Get Request ${http_session} ${path} headers=${headers} |
| 40 | Should Be Equal As Strings ${resp.status_code} ${resp_code} |
| 41 | |
| 42 | Create Header with CSR and PK |
| 43 | [Documentation] Create header with CSR and PK |
| 44 | [Arguments] ${csr_file} ${pk_file} |
| 45 | [Return] ${headers} |
| 46 | ${csr}= Get Data From File ${csr_file} |
| 47 | ${pk}= Get Data From File ${pk_file} |
| 48 | ${headers}= Create Dictionary CSR=${csr} PK=${pk} |
| 49 | |
| 50 | Send Post Request And Validate Response |
| 51 | [Documentation] Send request to passed url and validate received response |
| 52 | [Arguments] ${path} ${resp_code} |
| 53 | ${resp}= Post Request ${http_session} ${path} |
| 54 | Should Be Equal As Strings ${resp.status_code} ${resp_code} |
| 55 | |