@@ -16,6 +16,13 @@ let assetUid2 = ''
1616let jobId1 = ''
1717let jobId2 = ''
1818let jobId3 = ''
19+ let jobId4 = ''
20+ let jobId5 = ''
21+ let jobId6 = ''
22+ let jobId7 = ''
23+ let jobId8 = ''
24+ let jobId9 = ''
25+ let jobId10 = ''
1926let tokenUidDev = ''
2027let tokenUid = ''
2128
@@ -162,6 +169,228 @@ describe('BulkOperation api test', () => {
162169 . catch ( done )
163170 } )
164171
172+ it ( 'should publish entries with publishAllLocalized parameter set to true' , done => {
173+ const publishDetails = {
174+ entries : [
175+ {
176+ uid : entryUid1 ,
177+ content_type : multiPageCT . content_type . uid ,
178+ locale : 'en-us'
179+ }
180+ ] ,
181+ locales : [
182+ 'en-us'
183+ ] ,
184+ environments : [
185+ 'development'
186+ ]
187+ }
188+ doBulkOperation ( )
189+ . publish ( {
190+ details : publishDetails ,
191+ api_version : '3.2' ,
192+ publishAllLocalized : true
193+ } )
194+ . then ( ( response ) => {
195+ expect ( response . notice ) . to . not . equal ( undefined )
196+ expect ( response . job_id ) . to . not . equal ( undefined )
197+ // Store job ID for later status check
198+ jobId4 = response . job_id
199+ done ( )
200+ } )
201+ . catch ( done )
202+ } )
203+
204+ it ( 'should publish entries with publishAllLocalized parameter set to false' , done => {
205+ const publishDetails = {
206+ entries : [
207+ {
208+ uid : entryUid2 ,
209+ content_type : singlepageCT . content_type . uid ,
210+ locale : 'en-us'
211+ }
212+ ] ,
213+ locales : [
214+ 'en-us'
215+ ] ,
216+ environments : [
217+ 'development'
218+ ]
219+ }
220+ doBulkOperation ( )
221+ . publish ( {
222+ details : publishDetails ,
223+ api_version : '3.2' ,
224+ publishAllLocalized : false
225+ } )
226+ . then ( ( response ) => {
227+ expect ( response . notice ) . to . not . equal ( undefined )
228+ expect ( response . job_id ) . to . not . equal ( undefined )
229+ // Store job ID for later status check
230+ jobId5 = response . job_id
231+ done ( )
232+ } )
233+ . catch ( done )
234+ } )
235+
236+ it ( 'should publish assets with publishAllLocalized parameter' , done => {
237+ const publishDetails = {
238+ assets : [
239+ {
240+ uid : assetUid1
241+ }
242+ ] ,
243+ locales : [
244+ 'en-us'
245+ ] ,
246+ environments : [
247+ 'development'
248+ ]
249+ }
250+ doBulkOperation ( )
251+ . publish ( {
252+ details : publishDetails ,
253+ api_version : '3.2' ,
254+ publishAllLocalized : true
255+ } )
256+ . then ( ( response ) => {
257+ expect ( response . notice ) . to . not . equal ( undefined )
258+ expect ( response . job_id ) . to . not . equal ( undefined )
259+ // Store job ID for later status check
260+ jobId6 = response . job_id
261+ done ( )
262+ } )
263+ . catch ( done )
264+ } )
265+
266+ it ( 'should unpublish entries with unpublishAllLocalized parameter set to true' , done => {
267+ const unpublishDetails = {
268+ entries : [
269+ {
270+ uid : entryUid1 ,
271+ content_type : multiPageCT . content_type . uid ,
272+ locale : 'en-us'
273+ }
274+ ] ,
275+ locales : [
276+ 'en-us'
277+ ] ,
278+ environments : [
279+ 'development'
280+ ]
281+ }
282+ doBulkOperation ( )
283+ . unpublish ( {
284+ details : unpublishDetails ,
285+ api_version : '3.2' ,
286+ unpublishAllLocalized : true
287+ } )
288+ . then ( ( response ) => {
289+ expect ( response . notice ) . to . not . equal ( undefined )
290+ expect ( response . job_id ) . to . not . equal ( undefined )
291+ // Store job ID for later status check
292+ jobId7 = response . job_id
293+ done ( )
294+ } )
295+ . catch ( done )
296+ } )
297+
298+ it ( 'should unpublish entries with unpublishAllLocalized parameter set to false' , done => {
299+ const unpublishDetails = {
300+ entries : [
301+ {
302+ uid : entryUid2 ,
303+ content_type : singlepageCT . content_type . uid ,
304+ locale : 'en-us'
305+ }
306+ ] ,
307+ locales : [
308+ 'en-us'
309+ ] ,
310+ environments : [
311+ 'development'
312+ ]
313+ }
314+ doBulkOperation ( )
315+ . unpublish ( {
316+ details : unpublishDetails ,
317+ api_version : '3.2' ,
318+ unpublishAllLocalized : false
319+ } )
320+ . then ( ( response ) => {
321+ expect ( response . notice ) . to . not . equal ( undefined )
322+ expect ( response . job_id ) . to . not . equal ( undefined )
323+ // Store job ID for later status check
324+ jobId8 = response . job_id
325+ done ( )
326+ } )
327+ . catch ( done )
328+ } )
329+
330+ it ( 'should unpublish assets with unpublishAllLocalized parameter' , done => {
331+ const unpublishDetails = {
332+ assets : [
333+ {
334+ uid : assetUid1
335+ }
336+ ] ,
337+ locales : [
338+ 'en-us'
339+ ] ,
340+ environments : [
341+ 'development'
342+ ]
343+ }
344+ doBulkOperation ( )
345+ . unpublish ( {
346+ details : unpublishDetails ,
347+ api_version : '3.2' ,
348+ unpublishAllLocalized : true
349+ } )
350+ . then ( ( response ) => {
351+ expect ( response . notice ) . to . not . equal ( undefined )
352+ expect ( response . job_id ) . to . not . equal ( undefined )
353+ // Store job ID for later status check
354+ jobId9 = response . job_id
355+ done ( )
356+ } )
357+ . catch ( done )
358+ } )
359+
360+ it ( 'should publish entries with multiple parameters including publishAllLocalized' , done => {
361+ const publishDetails = {
362+ entries : [
363+ {
364+ uid : entryUid1 ,
365+ content_type : multiPageCT . content_type . uid ,
366+ locale : 'en-us'
367+ }
368+ ] ,
369+ locales : [
370+ 'en-us'
371+ ] ,
372+ environments : [
373+ 'development'
374+ ]
375+ }
376+ doBulkOperation ( )
377+ . publish ( {
378+ details : publishDetails ,
379+ api_version : '3.2' ,
380+ publishAllLocalized : true ,
381+ skip_workflow_stage : true ,
382+ approvals : true
383+ } )
384+ . then ( ( response ) => {
385+ expect ( response . notice ) . to . not . equal ( undefined )
386+ expect ( response . job_id ) . to . not . equal ( undefined )
387+ // Store job ID for later status check
388+ jobId10 = response . job_id
389+ done ( )
390+ } )
391+ . catch ( done )
392+ } )
393+
165394 it ( 'should wait for all jobs to be processed before checking status' , async ( ) => {
166395 await delay ( 5000 ) // Wait 5 seconds for jobs to be processed
167396 } )
@@ -216,6 +445,83 @@ describe('BulkOperation api test', () => {
216445 expect ( response . body ) . to . not . equal ( undefined )
217446 } )
218447
448+ it ( 'should get job status for publishAllLocalized=true job' , async ( ) => {
449+ const response = await waitForJobReady ( jobId4 )
450+
451+ expect ( response ) . to . not . equal ( undefined )
452+ expect ( response . uid ) . to . not . equal ( undefined )
453+ expect ( response . status ) . to . not . equal ( undefined )
454+ expect ( response . action ) . to . not . equal ( undefined )
455+ expect ( response . summary ) . to . not . equal ( undefined )
456+ expect ( response . body ) . to . not . equal ( undefined )
457+ } )
458+
459+ it ( 'should get job status for publishAllLocalized=false job' , async ( ) => {
460+ const response = await waitForJobReady ( jobId5 )
461+
462+ expect ( response ) . to . not . equal ( undefined )
463+ expect ( response . uid ) . to . not . equal ( undefined )
464+ expect ( response . status ) . to . not . equal ( undefined )
465+ expect ( response . action ) . to . not . equal ( undefined )
466+ expect ( response . summary ) . to . not . equal ( undefined )
467+ expect ( response . body ) . to . not . equal ( undefined )
468+ } )
469+
470+ it ( 'should get job status for asset publishAllLocalized job' , async ( ) => {
471+ const response = await waitForJobReady ( jobId6 )
472+
473+ expect ( response ) . to . not . equal ( undefined )
474+ expect ( response . uid ) . to . not . equal ( undefined )
475+ expect ( response . status ) . to . not . equal ( undefined )
476+ expect ( response . action ) . to . not . equal ( undefined )
477+ expect ( response . summary ) . to . not . equal ( undefined )
478+ expect ( response . body ) . to . not . equal ( undefined )
479+ } )
480+
481+ it ( 'should get job status for unpublishAllLocalized=true job' , async ( ) => {
482+ const response = await waitForJobReady ( jobId7 )
483+
484+ expect ( response ) . to . not . equal ( undefined )
485+ expect ( response . uid ) . to . not . equal ( undefined )
486+ expect ( response . status ) . to . not . equal ( undefined )
487+ expect ( response . action ) . to . not . equal ( undefined )
488+ expect ( response . summary ) . to . not . equal ( undefined )
489+ expect ( response . body ) . to . not . equal ( undefined )
490+ } )
491+
492+ it ( 'should get job status for unpublishAllLocalized=false job' , async ( ) => {
493+ const response = await waitForJobReady ( jobId8 )
494+
495+ expect ( response ) . to . not . equal ( undefined )
496+ expect ( response . uid ) . to . not . equal ( undefined )
497+ expect ( response . status ) . to . not . equal ( undefined )
498+ expect ( response . action ) . to . not . equal ( undefined )
499+ expect ( response . summary ) . to . not . equal ( undefined )
500+ expect ( response . body ) . to . not . equal ( undefined )
501+ } )
502+
503+ it ( 'should get job status for asset unpublishAllLocalized job' , async ( ) => {
504+ const response = await waitForJobReady ( jobId9 )
505+
506+ expect ( response ) . to . not . equal ( undefined )
507+ expect ( response . uid ) . to . not . equal ( undefined )
508+ expect ( response . status ) . to . not . equal ( undefined )
509+ expect ( response . action ) . to . not . equal ( undefined )
510+ expect ( response . summary ) . to . not . equal ( undefined )
511+ expect ( response . body ) . to . not . equal ( undefined )
512+ } )
513+
514+ it ( 'should get job status for multiple parameters job' , async ( ) => {
515+ const response = await waitForJobReady ( jobId10 )
516+
517+ expect ( response ) . to . not . equal ( undefined )
518+ expect ( response . uid ) . to . not . equal ( undefined )
519+ expect ( response . status ) . to . not . equal ( undefined )
520+ expect ( response . action ) . to . not . equal ( undefined )
521+ expect ( response . summary ) . to . not . equal ( undefined )
522+ expect ( response . body ) . to . not . equal ( undefined )
523+ } )
524+
219525 it ( 'should get job status with bulk_version parameter' , async ( ) => {
220526 await waitForJobReady ( jobId1 )
221527
0 commit comments