Skip to content

Commit fbb9d98

Browse files
[backend] revoiew (#4538)
1 parent 47feed7 commit fbb9d98

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

opencti-platform/opencti-graphql/tests/02-integration/02-resolvers/container-authorized-members-test.ts

+15-19
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
TEST_ORGANIZATION,
1414
USER_EDITOR
1515
} from '../../utils/testQuery';
16-
import { queryAsUserIsExpectedForbidden } from '../../utils/testQueryHelper';
16+
import { queryAsAdminWithSuccess, queryAsUserIsExpectedForbidden } from '../../utils/testQueryHelper';
1717
import { ENTITY_TYPE_CONTAINER_CASE_INCIDENT } from '../../../src/modules/case/case-incident/case-incident-types';
1818

1919
const CREATE_QUERY = gql`
@@ -450,7 +450,7 @@ describe('Case Incident Response and organization sharing standard behavior with
450450
settingsInternalId = queryResult.data?.settings?.id;
451451

452452
// Set EE
453-
const EEqueryResult = await adminQuery({
453+
const EEqueryResult = await queryAsAdminWithSuccess({
454454
query: PLATFORM_ORGANIZATION_QUERY,
455455
variables: {
456456
id: settingsInternalId,
@@ -459,7 +459,6 @@ describe('Case Incident Response and organization sharing standard behavior with
459459
]
460460
}
461461
});
462-
expect(EEqueryResult).not.toBeNull();
463462
expect(EEqueryResult?.data?.settingsEdit.fieldPatch.enterprise_edition).not.toBeUndefined();
464463
});
465464
it('should share Case Incident Response with Organization', async () => {
@@ -497,15 +496,13 @@ describe('Case Incident Response and organization sharing standard behavior with
497496
expect(queryResult?.data?.caseIncident).toBeNull();
498497
});
499498
it('should EE deactivated', async () => {
500-
const platformOrganization = await adminQuery({
499+
const EEDeactivationQuery = await queryAsAdminWithSuccess({
501500
query: PLATFORM_ORGANIZATION_QUERY,
502-
variables: { id: settingsInternalId,
503-
input: [
504-
{ key: 'enterprise_edition', value: [] },
505-
] }
501+
variables: {
502+
id: settingsInternalId,
503+
input: [{ key: 'enterprise_edition', value: [] }] },
506504
});
507-
expect(platformOrganization).not.toBeNull();
508-
expect(platformOrganization?.data?.settingsEdit.fieldPatch.enterprise_edition).toBeNull();
505+
expect(EEDeactivationQuery?.data?.settingsEdit.fieldPatch.enterprise_edition).toBeNull();
509506
});
510507
});
511508

@@ -535,7 +532,7 @@ describe('Case Incident Response and organization sharing standard behavior with
535532
settingsInternalId = queryResult.data?.settings?.id;
536533

537534
// Set plateform organization
538-
const platformOrganization = await adminQuery({
535+
const platformOrganization = await queryAsAdminWithSuccess({
539536
query: PLATFORM_ORGANIZATION_QUERY,
540537
variables: {
541538
id: settingsInternalId,
@@ -545,8 +542,6 @@ describe('Case Incident Response and organization sharing standard behavior with
545542
]
546543
}
547544
});
548-
549-
expect(platformOrganization).not.toBeNull();
550545
expect(platformOrganization?.data?.settingsEdit.fieldPatch.platform_organization).not.toBeUndefined();
551546
expect(platformOrganization?.data?.settingsEdit.fieldPatch.enterprise_edition).not.toBeUndefined();
552547
expect(platformOrganization?.data?.settingsEdit.fieldPatch.platform_organization.name).toEqual(PLATFORM_ORGANIZATION.name);
@@ -571,7 +566,7 @@ describe('Case Incident Response and organization sharing standard behavior with
571566
expect(caseIRQueryResult).not.toBeNull();
572567
expect(caseIRQueryResult.data?.caseIncident).toBeNull();
573568
});
574-
it('should Admin user Authorized Members activated', async () => {
569+
it('should Admin user activate Authorized Members', async () => {
575570
userEditorId = await getUserIdByEmail(USER_EDITOR.email);
576571
const caseIRUpdatedQueryResult = await queryAsAdmin({
577572
query: EDIT_AUTHORIZED_MEMBERS_QUERY,
@@ -641,15 +636,16 @@ describe('Case Incident Response and organization sharing standard behavior with
641636
});
642637
it('should plateform organization sharing and EE deactivated', async () => {
643638
// Remove plateform organization
644-
const platformOrganization = await adminQuery({
639+
const platformOrganization = await queryAsAdminWithSuccess({
645640
query: PLATFORM_ORGANIZATION_QUERY,
646-
variables: { id: settingsInternalId,
641+
variables: {
642+
id: settingsInternalId,
647643
input: [
648644
{ key: 'platform_organization', value: [] },
649-
{ key: 'enterprise_edition', value: [] }, // check null a la place de [}
650-
] }
645+
{ key: 'enterprise_edition', value: [] },
646+
]
647+
}
651648
});
652-
expect(platformOrganization).not.toBeNull();
653649
expect(platformOrganization?.data?.settingsEdit.fieldPatch.platform_organization).toBeNull();
654650
});
655651
it('should Case Incident Response deleted', async () => {

0 commit comments

Comments
 (0)