338d811706e69d2cb41dec45bec5c44573187127
[integration/csit.git] / tests / oom-platform-cert-service / certservice / cert-service-test.robot
1 *** Settings ***
2
3 Documentation     OOM Cert Service API test case scenarios
4 Library               RequestsLibrary
5 Resource          ./resources/cert-service-keywords.robot
6
7 Suite Setup       Create sessions
8
9 *** Test Cases ***
10
11 Health Check
12     [Tags]      OOM-CERT-SERVICE
13     [Documentation]   Service is up and running
14     Run health check
15
16 Reload Configuration
17     [Tags]      OOM-CERT-SERVICE
18     [Documentation]   Configuration was changed
19     Send Get Request And Validate Response  /reload  200
20
21 Check if application is ready
22     [Tags]      OOM-CERT-SERVICE
23     [Documentation]   Send request to /ready endpoint and expect 200
24     Send Get Request And Validate Response  /ready  200
25
26 Generate Certificate In RA Mode For CA Name
27     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-INITIALIZATION
28     [Documentation]  Send request to ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} endpoint and expect 200
29     Send Get Request with Header And Expect Success  ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME}  ${VALID_RA_CSR_FILE}  ${VALID_RA_PK_FILE}
30
31 Generate Certificate with all Sans types In RA Mode For CA Name
32     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-INITIALIZATION
33     [Documentation]  Send request to ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} endpoint and expect 200
34     Send Get Request with Header And Expect Success  ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME}  ${VALID_RA_ALL_SANS_CSR_FILE}  ${VALID_RA_ALL_SANS_PK_FILE}
35
36 Report Not Found Error When Path To Service Is Not Valid
37     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-INITIALIZATION
38     [Documentation]  Send request to ${CERT_SERVICE_ENDPOINT} endpoint and expect 404
39     Send Get Request with Header And Expect Error  ${CERT_SERVICE_ENDPOINT}  ${VALID_CLIENT_CSR_FILE}  ${VALID_CLIENT_PK_FILE}  404
40
41 Report Bad Request Error When Header Is Missing In Request
42     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-INITIALIZATION
43     [Documentation]  Send request without header to ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} endpoint and expect 400
44     Send Get Request And Validate Response  ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME}  400
45
46 Report Bad Request Error When CSR Is Not Valid
47     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-INITIALIZATION
48     [Documentation]  Send request to ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} endpoint and expect 400
49     Send Get Request with Header And Expect Error  ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME}  ${INVALID_CSR_FILE}  ${VALID_CLIENT_PK_FILE}  400
50
51 Report Bad Request Error When PK Is Not Valid
52     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-INITIALIZATION
53     [Documentation]  Send request to ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME} endpoint and expect 400
54     Send Get Request with Header And Expect Error  ${CERT_SERVICE_ENDPOINT}${CLIENT_CA_NAME}  ${VALID_CLIENT_CSR_FILE}  ${INVALID_PK_FILE}  400
55
56 Update Certificate With Key Update Request In RA Mode Should Succeed
57     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-UPDATE
58     [Documentation]  Send Initialization Request to ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} then for received certificate send Key Update Request to ${CERT_SERVICE_UPDATE_ENDPOINT}${RA_CA_NAME} endpoint and expect 200
59     Send Initialization Request And Key Update Request And Expect Success  ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME}  ${CERT_SERVICE_UPDATE_ENDPOINT}${RA_CA_NAME}
60     ...  ${VALID_IR_CSR_FOR_UPDATE}  ${VALID_IR_KEY_FOR_UPDATE}  ${VALID_KUR_CSR}  ${VALID_KUR_KEY}
61
62 Update Certificate With Certification Request When Subject Changed In RA Mode Should Succeed
63     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-UPDATE
64     [Documentation]  Send Initialization Request to ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} then for received certificate send Key Update Request to ${CERT_SERVICE_UPDATE_ENDPOINT}${RA_CA_NAME} endpoint and expect 200
65     Send Initialization Request And Certification Request And Expect Success  ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME}  ${CERT_SERVICE_UPDATE_ENDPOINT}${RA_CA_NAME}
66     ...  ${VALID_IR_CSR_FOR_UPDATE}  ${VALID_IR_KEY_FOR_UPDATE}  ${VALID_CR_CSR_CHANGED_SUBJECT}  ${VALID_CR_KEY_CHANGED_SUBJECT}
67
68 Update Certificate With Certification Request When Sans Changed In RA Mode Should Succeed
69     [Tags]      OOM-CERT-SERVICE    CERTIFICATE-UPDATE
70     [Documentation]  Send Initialization Request to ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME} then for received certificate send Key Update Request to ${CERT_SERVICE_UPDATE_ENDPOINT}${RA_CA_NAME} endpoint and expect 200
71     Send Initialization Request And Certification Request And Expect Success  ${CERT_SERVICE_ENDPOINT}${RA_CA_NAME}  ${CERT_SERVICE_UPDATE_ENDPOINT}${RA_CA_NAME}
72     ...  ${VALID_IR_CSR_FOR_UPDATE}  ${VALID_IR_KEY_FOR_UPDATE}  ${VALID_CR_CSR_CHANGED_SANS}  ${VALID_CR_KEY_CHANGED_SANS}
73
74 Cert Service Client successfully creates keystore.p12 and truststore.p12
75     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
76     [Documentation]  Run with correct env and expected exit code 0
77     Run Cert Service Client And Validate PKCS12 File Creation And Client Exit Code  ${VALID_ENV_FILE}  0
78
79 Cert Service Client successfully creates keystore.jks and truststore.jks
80     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
81     [Documentation]  Run with correct env and expected exit code 0
82     Run Cert Service Client And Validate JKS File Creation And Client Exit Code  ${VALID_ENV_FILE_JKS}  0
83
84 Cert Service Client successfully creates keystore and truststore with expected data with no OUTPUT_TYPE
85     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
86     [Documentation]  Run with correct env and PKCS12 files created with correct data
87     Run Cert Service Client And Validate PKCS12 Files Contain Expected Data  ${VALID_ENV_FILE}  0
88
89 Cert Service Client successfully creates keystore and truststore with all SANs types provided
90     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
91     [Documentation]  Run with correct env and expected exit code 0
92     Run Cert Service Client And Validate PKCS12 Files Contain Expected Data  ${VALID_ENV_FILE_ALL_SANS_TYPES}  0
93
94 Cert Service Client successfully creates keystore and truststore with expected data with OUTPUT_TYPE=JKS
95     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
96     [Documentation]  Run with correct env and JKS files created with correct data
97     Run Cert Service Client And Validate JKS Files Contain Expected Data  ${VALID_ENV_FILE_JKS}  0
98
99 Cert Service Client successfully creates keystore and truststore with expected data with OUTPUT_TYPE=P12
100     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
101     [Documentation]  Run with correct env and PKCS12 files created with correct data
102     Run Cert Service Client And Validate PKCS12 Files Contain Expected Data  ${VALID_ENV_FILE_P12}  0
103
104 Cert Service Client successfully creates keystore and truststore with expected data with OUTPUT_TYPE=PEM
105     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
106     [Documentation]  Run with correct env and PEM files created with correct data
107     Run Cert Service Client And Validate PEM Files Contain Expected Data  ${VALID_ENV_FILE_PEM}  0
108
109 Cert Service Client reports error when OUTPUT_TYPE is invalid
110     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
111     [Documentation]  Run with invalid OUTPUT_TYPE env and expected exit code 1
112     Run Cert Service Client And Validate Client Exit Code  ${INVALID_ENV_FILE_OUTPUT_TYPE}  1
113
114 Run Cert Service Client Container And Validate Exit Code And API Response
115     [Tags]      OOM-CERT-SERVICE    OOM-CERT-SERVICE-CLIENT
116     [Documentation]  Run with invalid CaName env and expected exit code 5
117     Run Cert Service Client And Validate Http Response Code And Client Exit Code  ${INVALID_ENV_FILE}  404  5
118