1
- /// <reference types="Cypress " />
1
+ /// <reference types="cypress " />
2
2
3
3
describe ( 'Certificates endpoints' , ( ) => {
4
4
let token ;
@@ -26,6 +26,7 @@ describe('Certificates endpoints', () => {
26
26
} ) ;
27
27
28
28
it ( 'Custom certificate lifecycle' , function ( ) {
29
+ // Create custom cert
29
30
cy . task ( 'backendApiPost' , {
30
31
token : token ,
31
32
path : '/api/nginx/certificates' ,
@@ -38,6 +39,7 @@ describe('Certificates endpoints', () => {
38
39
expect ( data ) . to . have . property ( 'id' ) ;
39
40
certID = data . id ;
40
41
42
+ // Upload files
41
43
cy . task ( 'backendApiPostFiles' , {
42
44
token : token ,
43
45
path : `/api/nginx/certificates/${ certID } /upload` ,
@@ -46,31 +48,31 @@ describe('Certificates endpoints', () => {
46
48
certificate_key : 'test.example.com-key.pem' ,
47
49
} ,
48
50
} ) . then ( ( data ) => {
49
- cy . validateSwaggerSchema ( 'post' , 201 , '/nginx/certificates/upload' , data ) ;
51
+ cy . validateSwaggerSchema ( 'post' , 200 , '/nginx/certificates/{certID} /upload' , data ) ;
50
52
expect ( data ) . to . have . property ( 'certificate' ) ;
51
53
expect ( data ) . to . have . property ( 'certificate_key' ) ;
52
54
53
- cy . task ( 'backendApiDelete' , {
55
+ // Get all certs
56
+ cy . task ( 'backendApiGet' , {
54
57
token : token ,
55
- path : ` /api/nginx/certificates/ ${ certID } `
58
+ path : ' /api/nginx/certificates?expand=owner'
56
59
} ) . 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
+ } ) ;
59
71
} ) ;
60
72
} ) ;
61
73
} ) ;
62
74
} ) ;
63
75
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
-
74
76
it ( 'Request Certificate - CVE-2024-46256/CVE-2024-46257' , function ( ) {
75
77
cy . task ( 'backendApiPost' , {
76
78
token : token ,
0 commit comments