aboutsummaryrefslogtreecommitdiffstats
path: root/tests/aaf/certservice/resources/cert-service-keywords.robot
blob: caec55aa832637e7d827c20a3e3b967c129a50cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
*** Settings ***

Library         RequestsLibrary
Library           HttpLibrary.HTTP
Library           Collections
Resource          ../../../common.robot
Resource          ./cert-service-properties.robot

*** Keywords ***

Create sessions
    [Documentation]  Create all required sessions
    Create Session    aaf_cert_service_url    ${AAFCERT_URL}
    Set Suite Variable    ${http_session}    aaf_cert_service_url

Run Healthcheck
    [Documentation]  Run Healthcheck
    ${resp}=  Get Request   ${http_session}   /actuator/health
    Should Be Equal As Strings  ${resp.status_code}   200
    Validate Recieved Response  ${resp}  status  UP

Send Request And Validate Response
    [Documentation]   Send request to passed url and validate received response
    [Arguments]   ${path}  ${csr_file}  ${pk_file}  ${resp_code}
    ${csr}=  Get Data From File  ${csr_file}
    ${pk}=   Get Data From File  ${pk_file}
    ${headers}=  Create Dictionary  CSR=${csr}  PK=${pk}
    ${resp}=  Get Request   ${http_session}  ${path}  headers=${headers}
    Should Be Equal As Strings  ${resp.status_code}   ${resp_code}

Validate Recieved Response
    [Documentation]  Validare message that has been received
    [Arguments]  ${resp}  ${key}  ${expected_value}
    ${json}=    Parse Json      ${resp.content}
    ${value}=  get from dictionary  ${json}  ${key}
    Should Be Equal As Strings    ${value}    ${expected_value}