@@ -10,9 +10,7 @@ import {
10
10
PLATFORM_ORGANIZATION ,
11
11
queryAsAdmin ,
12
12
securityQuery ,
13
- TEST_ORGANIZATION ,
14
13
USER_EDITOR ,
15
- USER_SECURITY
16
14
} from '../../utils/testQuery' ;
17
15
import type { CaseIncident , EntitySettingEdge } from '../../../src/generated/graphql' ;
18
16
import { ENTITY_TYPE_CONTAINER_CASE_INCIDENT } from '../../../src/modules/case/case-incident/case-incident-types' ;
@@ -350,20 +348,7 @@ describe('Case Incident Response standard behavior with authorized_members activ
350
348
} ) ;
351
349
352
350
describe ( 'Case Incident Response and organization sharing standard behavior without platform organization' , ( ) => {
353
- let testOrganizationId : string ;
354
351
let caseIrId : string ;
355
- let userSecurityId : string ;
356
- let settingsInternalId : string ;
357
- const EE_QUERY = gql `
358
- mutation PoliciesFieldPatchMutation($id: ID!, $input: [EditInput]!) {
359
- settingsEdit(id: $id) {
360
- fieldPatch(input: $input) {
361
- enterprise_edition
362
- id
363
- }
364
- }
365
- }
366
- ` ;
367
352
it ( 'should Case Incident Response created' , async ( ) => {
368
353
// Create Case Incident Response
369
354
const caseIRCreateQueryResult = await adminQuery ( {
@@ -380,67 +365,13 @@ describe('Case Incident Response and organization sharing standard behavior with
380
365
expect ( caseIRCreateQueryResult ?. data ?. caseIncidentAdd . authorized_members ) . toEqual ( [ ] ) ; // authorized members not activated
381
366
caseIrId = caseIRCreateQueryResult ?. data ?. caseIncidentAdd . id ;
382
367
} ) ;
383
- it ( 'should EE activated' , async ( ) => {
384
- // Get settings ID
385
- const SETTINGS_READ_QUERY = gql `
386
- query settings {
387
- settings {
388
- id
389
- }
390
- }
391
- ` ;
392
- const queryResult = await adminQuery ( { query : SETTINGS_READ_QUERY , variables : { } } ) ;
393
- settingsInternalId = queryResult . data ?. settings ?. id ;
394
-
395
- // Set plateform organization
396
- const eeActivationQuery = await adminQuery ( {
397
- query : EE_QUERY ,
398
- variables : {
399
- id : settingsInternalId ,
400
- input : [
401
- { key : 'enterprise_edition' , value : new Date ( ) . getTime ( ) } ,
402
- ]
403
- }
404
- } ) ;
405
-
406
- expect ( eeActivationQuery ) . not . toBeNull ( ) ;
407
- expect ( eeActivationQuery ?. data ?. settingsEdit . fieldPatch . enterprise_edition ) . not . toBeUndefined ( ) ;
408
- } ) ;
409
- it ( 'should share Case Incident Response with Organization' , async ( ) => {
410
- // Get organization id
411
- testOrganizationId = await getOrganizationIdByName ( TEST_ORGANIZATION . name ) ;
412
- const ORGANIZATION_SHARING_QUERY = gql `
413
- mutation StixCoreObjectSharingGroupAddMutation(
414
- $id: ID!
415
- $organizationId: ID!
416
- ) {
417
- stixCoreObjectEdit(id: $id) {
418
- restrictionOrganizationAdd(organizationId: $organizationId) {
419
- id
420
- objectOrganization {
421
- id
422
- name
423
- }
424
- }
425
- }
426
- }
427
- ` ;
428
-
429
- const organizationSharingQueryResult = await adminQuery ( {
430
- query : ORGANIZATION_SHARING_QUERY ,
431
- variables : { id : caseIrId , organizationId : testOrganizationId }
432
- } ) ;
433
- expect ( organizationSharingQueryResult ) . not . toBeNull ( ) ;
434
- expect ( organizationSharingQueryResult ?. data ?. stixCoreObjectEdit . restrictionOrganizationAdd ) . not . toBeNull ( ) ;
435
- expect ( organizationSharingQueryResult ?. data ?. stixCoreObjectEdit . restrictionOrganizationAdd . objectOrganization [ 0 ] . name ) . toEqual ( TEST_ORGANIZATION . name ) ;
436
- } ) ;
437
- it ( 'should not access Case Incident Response' , async ( ) => {
438
- const caseIRQueryResult = await securityQuery ( { query : READ_QUERY , variables : { id : caseIrId } } ) ; // USER_SECURITY is not part of TEST_ORGANIZATION
368
+ it ( 'should access Case Incident Response' , async ( ) => {
369
+ const caseIRQueryResult = await securityQuery ( { query : READ_QUERY , variables : { id : caseIrId } } ) ;
439
370
expect ( caseIRQueryResult ) . not . toBeNull ( ) ;
440
- expect ( caseIRQueryResult . data ?. caseIncident ) . toBeNull ( ) ;
371
+ expect ( caseIRQueryResult ?. data ?. caseIncident ) . not . toBeUndefined ( ) ;
372
+ expect ( caseIRQueryResult ?. data ?. caseIncident . id ) . toEqual ( caseIrId ) ;
441
373
} ) ;
442
374
it ( 'should Authorized Members activated' , async ( ) => {
443
- userSecurityId = await getUserIdByEmail ( USER_SECURITY . email ) ;
444
375
await queryAsAdmin ( {
445
376
query : EDIT_AUTHORIZED_MEMBERS_QUERY ,
446
377
variables : {
@@ -449,10 +380,6 @@ describe('Case Incident Response and organization sharing standard behavior with
449
380
{
450
381
id : ADMIN_USER . id ,
451
382
access_right : 'admin'
452
- } ,
453
- {
454
- id : userSecurityId ,
455
- access_right : 'view'
456
383
}
457
384
]
458
385
}
@@ -468,18 +395,14 @@ describe('Case Incident Response and organization sharing standard behavior with
468
395
{
469
396
id : ADMIN_USER . id ,
470
397
access_right : 'admin'
471
- } ,
472
- {
473
- id : userSecurityId ,
474
- access_right : 'view'
475
398
}
476
399
] ) ;
477
400
} ) ;
478
- it ( 'should access Case Incident Response out of her organization if authorized members activated ' , async ( ) => {
401
+ it ( 'should not access Case Incident Response if not in authorized members' , async ( ) => {
479
402
const caseIRQueryResult = await securityQuery ( { query : READ_QUERY , variables : { id : caseIrId } } ) ;
480
403
expect ( caseIRQueryResult ) . not . toBeNull ( ) ;
481
404
expect ( caseIRQueryResult ?. data ?. caseIncident ) . not . toBeUndefined ( ) ;
482
- expect ( caseIRQueryResult ?. data ?. caseIncident . id ) . toEqual ( caseIrId ) ;
405
+ expect ( caseIRQueryResult ?. data ?. caseIncident ) . toBeNull ( ) ;
483
406
} ) ;
484
407
it ( 'should Case Incident Response deleted' , async ( ) => {
485
408
// Delete the case
@@ -492,18 +415,6 @@ describe('Case Incident Response and organization sharing standard behavior with
492
415
expect ( queryResult ) . not . toBeNull ( ) ;
493
416
expect ( queryResult ?. data ?. caseIncident ) . toBeNull ( ) ;
494
417
} ) ;
495
- it ( 'should EE deactivated' , async ( ) => {
496
- // Remove EE
497
- const eeDeactivationQuery = await adminQuery ( {
498
- query : EE_QUERY ,
499
- variables : { id : settingsInternalId ,
500
- input : [
501
- { key : 'enterprise_edition' , value : [ ] } ,
502
- ] }
503
- } ) ;
504
- expect ( eeDeactivationQuery ) . not . toBeNull ( ) ;
505
- expect ( eeDeactivationQuery ?. data ?. settingsEdit . fieldPatch . enterprise_edition ) . toBeNull ( ) ;
506
- } ) ;
507
418
} ) ;
508
419
509
420
describe ( 'Case Incident Response and organization sharing standard behavior with platform organization' , ( ) => {
0 commit comments