1- import { validateApiResponse , validate_200_Status , validate_404_Status , getTokenKey } from '../support/commands' ;
1+ import {
2+ validateApiResponse ,
3+ validate_200_Status ,
4+ validate_404_Status ,
5+ getTokenKey ,
6+ getAPIBaseURL ,
7+ getXACLHeader ,
8+ } from '../support/commands' ;
29
310describe ( "To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on child project" , function ( ) {
411 // Define a variable for the environment
@@ -14,7 +21,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
1421
1522 //Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/cla-group
1623
17- const claEndpoint = ` ${ Cypress . env ( 'APP_URL' ) } cla-service/v4` ;
24+ const claEndpoint = getAPIBaseURL ( 'v4' ) ;
1825 let claGroupId : string = '' ;
1926
2027 //Variable for create cla group
@@ -49,9 +56,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
4956 it ( 'Creates a new CLA Group at child level - Record should return 200 Response' , function ( ) {
5057 cy . request ( {
5158 method : 'POST' ,
52- url : `${ claEndpoint } / cla-group` ,
59+ url : `${ claEndpoint } cla-group` ,
5360 failOnStatusCode : allowFail ,
54-
61+ headers : getXACLHeader ( ) ,
5562 auth : {
5663 bearer : bearerToken ,
5764 } ,
@@ -106,9 +113,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
106113 it ( 'Get list of cla group associated with project - Record should return 200 Response' , function ( ) {
107114 cy . request ( {
108115 method : 'GET' ,
109- url : `${ claEndpoint } / foundation/${ projectSfid } /cla-groups` ,
116+ url : `${ claEndpoint } foundation/${ projectSfid } /cla-groups` ,
110117 failOnStatusCode : allowFail ,
111-
118+ headers : getXACLHeader ( ) ,
112119 auth : {
113120 bearer : bearerToken ,
114121 } ,
@@ -130,8 +137,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
130137 it ( 'Attempt to get list of cla group associated with project given by wrong SFID - Record should Return 404 Response' , function ( ) {
131138 cy . request ( {
132139 method : 'GET' ,
133- url : `${ claEndpoint } / foundation/${ projectSfid } -xyz/cla-groups` ,
140+ url : `${ claEndpoint } foundation/${ projectSfid } -xyz/cla-groups` ,
134141 failOnStatusCode : false ,
142+ headers : getXACLHeader ( ) ,
135143 auth : {
136144 bearer : bearerToken ,
137145 } ,
@@ -145,9 +153,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
145153 it ( 'Updates a CLA Group details - Record should return 200 Response' , function ( ) {
146154 cy . request ( {
147155 method : 'PUT' ,
148- url : `${ claEndpoint } / cla-group/${ claGroupId } ` ,
156+ url : `${ claEndpoint } cla-group/${ claGroupId } ` ,
149157 failOnStatusCode : allowFail ,
150-
158+ headers : getXACLHeader ( ) ,
151159 auth : {
152160 bearer : bearerToken ,
153161 } ,
@@ -171,9 +179,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
171179 it ( 'Enroll projects in a CLA Group - Record should return 200 Response' , function ( ) {
172180 cy . request ( {
173181 method : 'PUT' ,
174- url : `${ claEndpoint } / cla-group/${ claGroupId } /enroll-projects` ,
182+ url : `${ claEndpoint } cla-group/${ claGroupId } /enroll-projects` ,
175183 failOnStatusCode : allowFail ,
176-
184+ headers : getXACLHeader ( ) ,
177185 auth : {
178186 bearer : bearerToken ,
179187 } ,
@@ -186,9 +194,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
186194 // Run the second API request
187195 cy . request ( {
188196 method : 'GET' ,
189- url : `${ claEndpoint } / foundation/${ projectSfid } /cla-groups` ,
197+ url : `${ claEndpoint } foundation/${ projectSfid } /cla-groups` ,
190198 failOnStatusCode : allowFail ,
191-
199+ headers : getXACLHeader ( ) ,
192200 auth : {
193201 bearer : bearerToken ,
194202 } ,
@@ -209,9 +217,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
209217 it ( 'Unenroll projects in a CLA Group - Record should return 200 Response' , function ( ) {
210218 cy . request ( {
211219 method : 'PUT' ,
212- url : `${ claEndpoint } / cla-group/${ claGroupId } /unenroll-projects` ,
220+ url : `${ claEndpoint } cla-group/${ claGroupId } /unenroll-projects` ,
213221 failOnStatusCode : allowFail ,
214-
222+ headers : getXACLHeader ( ) ,
215223 auth : {
216224 bearer : bearerToken ,
217225 } ,
@@ -225,9 +233,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
225233 it ( 'Get list of Github organization associated with project - Record should return 200 Response' , function ( ) {
226234 cy . request ( {
227235 method : 'GET' ,
228- url : `${ claEndpoint } / project/${ projectSfidOrg } /github/organizations` ,
236+ url : `${ claEndpoint } project/${ projectSfidOrg } /github/organizations` ,
229237 failOnStatusCode : allowFail ,
230-
238+ headers : getXACLHeader ( ) ,
231239 auth : {
232240 bearer : bearerToken ,
233241 } ,
@@ -248,9 +256,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
248256 it ( 'Update GitHub Organization Configuration - Record should return 200 Response' , function ( ) {
249257 cy . request ( {
250258 method : 'PUT' ,
251- url : `${ claEndpoint } / project/${ projectSfidOrg } /github/organizations/${ gitHubOrgName } /config` ,
259+ url : `${ claEndpoint } project/${ projectSfidOrg } /github/organizations/${ gitHubOrgName } /config` ,
252260 failOnStatusCode : allowFail ,
253-
261+ headers : getXACLHeader ( ) ,
254262 auth : {
255263 bearer : bearerToken ,
256264 } ,
@@ -268,9 +276,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
268276 if ( claGroupId != null ) {
269277 cy . request ( {
270278 method : 'DELETE' ,
271- url : `${ claEndpoint } / cla-group/${ claGroupId } ` ,
279+ url : `${ claEndpoint } cla-group/${ claGroupId } ` ,
272280 failOnStatusCode : allowFail ,
273-
281+ headers : getXACLHeader ( ) ,
274282 auth : {
275283 bearer : bearerToken ,
276284 } ,
@@ -281,9 +289,9 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
281289 // Run the second API request
282290 cy . request ( {
283291 method : 'GET' ,
284- url : `${ claEndpoint } / foundation/${ projectSfid } /cla-groups` ,
292+ url : `${ claEndpoint } foundation/${ projectSfid } /cla-groups` ,
285293 failOnStatusCode : allowFail ,
286-
294+ headers : getXACLHeader ( ) ,
287295 auth : {
288296 bearer : bearerToken ,
289297 } ,
0 commit comments