1- /// <reference types="Cypress " />
1+ /// <reference types="cypress " />
22
33describe ( 'Certificates endpoints' , ( ) => {
44 let token ;
@@ -26,6 +26,7 @@ describe('Certificates endpoints', () => {
2626 } ) ;
2727
2828 it ( 'Custom certificate lifecycle' , function ( ) {
29+ // Create custom cert
2930 cy . task ( 'backendApiPost' , {
3031 token : token ,
3132 path : '/api/nginx/certificates' ,
@@ -38,6 +39,7 @@ describe('Certificates endpoints', () => {
3839 expect ( data ) . to . have . property ( 'id' ) ;
3940 certID = data . id ;
4041
42+ // Upload files
4143 cy . task ( 'backendApiPostFiles' , {
4244 token : token ,
4345 path : `/api/nginx/certificates/${ certID } /upload` ,
@@ -46,31 +48,31 @@ describe('Certificates endpoints', () => {
4648 certificate_key : 'test.example.com-key.pem' ,
4749 } ,
4850 } ) . then ( ( data ) => {
49- cy . validateSwaggerSchema ( 'post' , 201 , '/nginx/certificates/upload' , data ) ;
51+ cy . validateSwaggerSchema ( 'post' , 200 , '/nginx/certificates/{certID} /upload' , data ) ;
5052 expect ( data ) . to . have . property ( 'certificate' ) ;
5153 expect ( data ) . to . have . property ( 'certificate_key' ) ;
5254
53- cy . task ( 'backendApiDelete' , {
55+ // Get all certs
56+ cy . task ( 'backendApiGet' , {
5457 token : token ,
55- path : ` /api/nginx/certificates/ ${ certID } `
58+ path : ' /api/nginx/certificates?expand=owner'
5659 } ) . then ( ( data ) => {
57- cy . validateSwaggerSchema ( 'delete' , 200 , '/nginx/certificates/{certID}' , data ) ;
58- expect ( data ) . to . be . equal ( true ) ;
60+ cy . validateSwaggerSchema ( 'get' , 200 , '/nginx/certificates' , data ) ;
61+ expect ( data . length ) . to . be . greaterThan ( 0 ) ;
62+
63+ // Delete cert
64+ cy . task ( 'backendApiDelete' , {
65+ token : token ,
66+ path : `/api/nginx/certificates/${ certID } `
67+ } ) . then ( ( data ) => {
68+ cy . validateSwaggerSchema ( 'delete' , 200 , '/nginx/certificates/{certID}' , data ) ;
69+ expect ( data ) . to . be . equal ( true ) ;
70+ } ) ;
5971 } ) ;
6072 } ) ;
6173 } ) ;
6274 } ) ;
6375
64- it ( 'Should be able to get all certs' , function ( ) {
65- cy . task ( 'backendApiGet' , {
66- token : token ,
67- path : '/api/nginx/certificates?expand=owner'
68- } ) . then ( ( data ) => {
69- cy . validateSwaggerSchema ( 'get' , 200 , '/nginx/certificates' , data ) ;
70- expect ( data . length ) . to . be . greaterThan ( 0 ) ;
71- } ) ;
72- } ) ;
73-
7476 it ( 'Request Certificate - CVE-2024-46256/CVE-2024-46257' , function ( ) {
7577 cy . task ( 'backendApiPost' , {
7678 token : token ,
0 commit comments