blob: b40da5243779acd5e78743e7a0993363cd90d932 [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
Aleksandra Maciaga6def5972020-02-20 09:42:03 +010022Validate Recieved Response
23 [Documentation] Validare message that has been received
24 [Arguments] ${resp} ${key} ${expected_value}
25 ${json}= Parse Json ${resp.content}
Aleksandra Maciaga8d762b12020-02-24 14:24:42 +010026 ${value}= Get From Dictionary ${json} ${key}
27 Should Be Equal As Strings ${value} ${expected_value}
28
29Send 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
35Send 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
42Create 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
50Send 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