@@ -87,6 +87,23 @@ const PLATFORM_ORGANIZATION_QUERY = gql`
87
87
}
88
88
` ;
89
89
90
+ const ORGANIZATION_SHARING_QUERY = gql `
91
+ mutation StixCoreObjectSharingGroupAddMutation(
92
+ $id: ID!
93
+ $organizationId: ID!
94
+ ) {
95
+ stixCoreObjectEdit(id: $id) {
96
+ restrictionOrganizationAdd(organizationId: $organizationId) {
97
+ id
98
+ objectOrganization {
99
+ id
100
+ name
101
+ }
102
+ }
103
+ }
104
+ }
105
+ ` ;
106
+
90
107
describe ( 'Case Incident Response standard behavior with authorized_members activation from entity' , ( ) => {
91
108
let caseIncident : CaseIncident ;
92
109
let userEditorId : string ;
@@ -485,26 +502,9 @@ describe('Case Incident Response and organization sharing standard behavior with
485
502
it ( 'should share Case Incident Response with Organization' , async ( ) => {
486
503
// Get organization id
487
504
organizationId = await getOrganizationIdByName ( PLATFORM_ORGANIZATION . name ) ;
488
- const ORGANIZATION_SHARING_QUERY = gql `
489
- mutation StixCoreObjectSharingGroupAddMutation(
490
- $id: ID!
491
- $organizationId: ID!
492
- ) {
493
- stixCoreObjectEdit(id: $id) {
494
- restrictionOrganizationAdd(organizationId: $organizationId) {
495
- id
496
- objectOrganization {
497
- id
498
- name
499
- }
500
- }
501
- }
502
- }
503
- ` ;
504
-
505
505
const organizationSharingQueryResult = await adminQuery ( {
506
506
query : ORGANIZATION_SHARING_QUERY ,
507
- variables : { id : caseIrId , organizationId : PLATFORM_ORGANIZATION . id }
507
+ variables : { id : caseIrId , organizationId }
508
508
} ) ;
509
509
expect ( organizationSharingQueryResult ) . not . toBeNull ( ) ;
510
510
expect ( organizationSharingQueryResult ?. data ?. stixCoreObjectEdit . restrictionOrganizationAdd ) . not . toBeNull ( ) ;
@@ -659,17 +659,12 @@ describe('Case Incident Response and organization sharing standard behavior with
659
659
expect ( caseIRQueryResult ?. data ?. caseIncident . id ) . toEqual ( caseIrId ) ;
660
660
} ) ;
661
661
// 6. On enlève les authorized members, et on vérifie que l'editor n'as plus accès au case
662
- it ( 'should Admin user removes Editor user from authorized members' , async ( ) => {
662
+ it ( 'should Admin user deactivate authorized members' , async ( ) => {
663
663
await queryAsAdmin ( {
664
664
query : EDIT_AUTHORIZED_MEMBERS_QUERY ,
665
665
variables : {
666
666
id : caseIrId ,
667
- input : [
668
- {
669
- id : ADMIN_USER . id ,
670
- access_right : 'admin'
671
- }
672
- ]
667
+ input : null
673
668
}
674
669
} ) ;
675
670
// Verify Editor user has no more access to Case incident
@@ -681,23 +676,6 @@ describe('Case Incident Response and organization sharing standard behavior with
681
676
it ( 'should share Case Incident Response with Organization' , async ( ) => {
682
677
// Get organization id
683
678
testOrganizationId = await getOrganizationIdByName ( TEST_ORGANIZATION . name ) ;
684
- const ORGANIZATION_SHARING_QUERY = gql `
685
- mutation StixCoreObjectSharingGroupAddMutation(
686
- $id: ID!
687
- $organizationId: ID!
688
- ) {
689
- stixCoreObjectEdit(id: $id) {
690
- restrictionOrganizationAdd(organizationId: $organizationId) {
691
- id
692
- objectOrganization {
693
- id
694
- name
695
- }
696
- }
697
- }
698
- }
699
- ` ;
700
-
701
679
const organizationSharingQueryResult = await adminQuery ( {
702
680
query : ORGANIZATION_SHARING_QUERY ,
703
681
variables : { id : caseIrId , organizationId : testOrganizationId }
@@ -708,7 +686,6 @@ describe('Case Incident Response and organization sharing standard behavior with
708
686
709
687
// Verify Editor user has access to Case incident
710
688
const caseIRQueryResult = await editorQuery ( { query : READ_QUERY , variables : { id : caseIrId } } ) ;
711
- console . log ( JSON . stringify ( caseIRQueryResult ) ) ;
712
689
expect ( caseIRQueryResult ) . not . toBeNull ( ) ;
713
690
expect ( caseIRQueryResult ?. data ?. caseIncident ) . not . toBeUndefined ( ) ;
714
691
expect ( caseIRQueryResult ?. data ?. caseIncident . id ) . toEqual ( caseIrId ) ;
0 commit comments