@@ -265,7 +265,6 @@ describe('Project create', () => {
265265 type : 'generic' ,
266266 description : 'test project' ,
267267 details : { } ,
268- billingAccountId : 1 ,
269268 name : 'test project1' ,
270269 bookmarks : [ {
271270 title : 'title1' ,
@@ -277,7 +276,6 @@ describe('Project create', () => {
277276 type : 'generic' ,
278277 description : 'test project' ,
279278 details : { } ,
280- billingAccountId : 1 ,
281279 name : 'test project1' ,
282280 attachments : [
283281 {
@@ -399,6 +397,34 @@ describe('Project create', () => {
399397 . expect ( 400 , done ) ;
400398 } ) ;
401399
400+ it ( `should return 400 when creating project with billingAccountId
401+ without "write:projects-billing-accounts" scope in M2M token` , ( done ) => {
402+ const validBody = _ . cloneDeep ( body ) ;
403+ validBody . billingAccountId = 1 ;
404+ request ( server )
405+ . post ( '/v5/projects' )
406+ . set ( {
407+ Authorization : `Bearer ${ testUtil . m2m [ 'write:projects' ] } ` ,
408+ } )
409+ . send ( validBody )
410+ . expect ( 'Content-Type' , / j s o n / )
411+ . expect ( 400 , done ) ;
412+ } ) ;
413+
414+ it ( `should return 400 when creating project with directProjectId
415+ without "write:projects" scope in M2M token` , ( done ) => {
416+ const validBody = _ . cloneDeep ( body ) ;
417+ validBody . directProjectId = 1 ;
418+ request ( server )
419+ . post ( '/v5/projects' )
420+ . set ( {
421+ Authorization : `Bearer ${ testUtil . m2m [ 'write:project-members' ] } ` ,
422+ } )
423+ . send ( validBody )
424+ . expect ( 'Content-Type' , / j s o n / )
425+ . expect ( 400 , done ) ;
426+ } ) ;
427+
402428 it ( 'should return 201 if valid user and data' , ( done ) => {
403429 const validBody = _ . cloneDeep ( body ) ;
404430 validBody . templateId = 3 ;
@@ -433,7 +459,7 @@ describe('Project create', () => {
433459 } else {
434460 const resJson = res . body ;
435461 should . exist ( resJson ) ;
436- should . exist ( resJson . billingAccountId ) ;
462+ should . not . exist ( resJson . billingAccountId ) ;
437463 should . exist ( resJson . name ) ;
438464 resJson . status . should . be . eql ( 'in_review' ) ;
439465 resJson . type . should . be . eql ( body . type ) ;
@@ -489,7 +515,7 @@ describe('Project create', () => {
489515 } else {
490516 const resJson = res . body ;
491517 should . exist ( resJson ) ;
492- should . exist ( resJson . billingAccountId ) ;
518+ should . not . exist ( resJson . billingAccountId ) ;
493519 should . exist ( resJson . name ) ;
494520 resJson . status . should . be . eql ( 'in_review' ) ;
495521 resJson . type . should . be . eql ( body . type ) ;
@@ -544,7 +570,7 @@ describe('Project create', () => {
544570 } else {
545571 const resJson = res . body ;
546572 should . exist ( resJson ) ;
547- should . exist ( resJson . billingAccountId ) ;
573+ should . not . exist ( resJson . billingAccountId ) ;
548574 should . exist ( resJson . name ) ;
549575 resJson . status . should . be . eql ( 'in_review' ) ;
550576 resJson . type . should . be . eql ( body . type ) ;
@@ -598,7 +624,7 @@ describe('Project create', () => {
598624 } else {
599625 const resJson = res . body ;
600626 should . exist ( resJson ) ;
601- should . exist ( resJson . billingAccountId ) ;
627+ should . not . exist ( resJson . billingAccountId ) ;
602628 should . exist ( resJson . name ) ;
603629 resJson . status . should . be . eql ( 'in_review' ) ;
604630 resJson . type . should . be . eql ( bodyWithAttachments . type ) ;
@@ -679,7 +705,7 @@ describe('Project create', () => {
679705 } else {
680706 const resJson = res . body ;
681707 should . exist ( resJson ) ;
682- should . exist ( resJson . billingAccountId ) ;
708+ should . not . exist ( resJson . billingAccountId ) ;
683709 should . exist ( resJson . name ) ;
684710 resJson . status . should . be . eql ( 'in_review' ) ;
685711 resJson . type . should . be . eql ( body . type ) ;
@@ -752,7 +778,7 @@ describe('Project create', () => {
752778 } else {
753779 const resJson = res . body ;
754780 should . exist ( resJson ) ;
755- should . exist ( resJson . billingAccountId ) ;
781+ should . not . exist ( resJson . billingAccountId ) ;
756782 should . exist ( resJson . name ) ;
757783 resJson . status . should . be . eql ( 'in_review' ) ;
758784 resJson . type . should . be . eql ( body . type ) ;
@@ -885,7 +911,7 @@ describe('Project create', () => {
885911 } else {
886912 const resJson = res . body ;
887913 should . exist ( resJson ) ;
888- should . exist ( resJson . billingAccountId ) ;
914+ should . not . exist ( resJson . billingAccountId ) ;
889915 should . exist ( resJson . name ) ;
890916 resJson . status . should . be . eql ( 'in_review' ) ;
891917 resJson . type . should . be . eql ( body . type ) ;
0 commit comments