Skip to content

Commit

Permalink
[backend] WIP: test (#8333)
Browse files Browse the repository at this point in the history
  • Loading branch information
marieflorescontact committed Sep 19, 2024
1 parent b2e6eb1 commit b46de27
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export const STIX_ORGANIZATIONS_UNRESTRICTED = [
ABSTRACT_STIX_REF_RELATIONSHIP,
ENTITY_TYPE_IDENTITY_ORGANIZATION,
ENTITY_TYPE_IDENTITY_SECTOR,
ENTITY_TYPE_IDENTITY_SYSTEM,
ENTITY_TYPE_IDENTITY_INDIVIDUAL,
// ENTITY_TYPE_IDENTITY_SYSTEM,
// ENTITY_TYPE_IDENTITY_INDIVIDUAL,
ENTITY_TYPE_LOCATION,
ENTITY_TYPE_WORK, // Work is defined as an history object
ENTITY_TYPE_TAXII_COLLECTION, // TODO TaxiiCollection must be migrate to add according parent types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import { describe, expect, it } from 'vitest';
import gql from 'graphql-tag';
import { ADMIN_USER, adminQuery, getOrganizationIdByName, PLATFORM_ORGANIZATION, testContext, USER_SECURITY } from '../../utils/testQuery';
import {
ADMIN_API_TOKEN,
ADMIN_USER,
adminQuery,
API_URI,
FIVE_MINUTES,
getOrganizationIdByName,
PLATFORM_ORGANIZATION,
PYTHON_PATH,
testContext,
USER_SECURITY
} from '../../utils/testQuery';
import { adminQueryWithSuccess, queryAsUserWithSuccess } from '../../utils/testQueryHelper';
import { findById } from '../../../src/domain/report';
import { execChildPython } from '../../../src/python/pythonBridge';

const READ_QUERY = gql`
query caseIncident($id: String!) {
Expand Down Expand Up @@ -57,6 +69,23 @@ const ORGANIZATION_SHARING_QUERY = gql`
}
`;

const importOpts: string[] = [API_URI, ADMIN_API_TOKEN, './tests/data/DATA-TEST-STIX2_v2.json'];

describe('Database provision', () => {
it('Should import creation succeed', async () => {
// Inject data
const execution = await execChildPython(testContext, ADMIN_USER, PYTHON_PATH, 'local_importer.py', importOpts);
expect(execution).not.toBeNull();
expect(execution.status).toEqual('success');
}, FIVE_MINUTES);
// Python lib is fixed but we need to wait for a new release
it('Should import update succeed', async () => {
const execution = await execChildPython(testContext, ADMIN_USER, PYTHON_PATH, 'local_importer.py', importOpts);
expect(execution).not.toBeNull();
expect(execution.status).toEqual('success');
}, FIVE_MINUTES);
});

describe('Organization sharing standard behavior for container', () => {
let reportInternalId: string;
let organizationId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@
"confidence": 100,
"created": "2024-09-12T09:47:15.000Z",
"modified": "2024-09-17T08:52:19.988Z",
"name": "orag sharing test",
"name": "organization sharing test",
"published": "2024-09-12T09:47:15.000Z",
"x_opencti_workflow_id": "19b6920b-9e66-4c3d-9b2e-d2bf072679a6",
"labels": [
Expand Down Expand Up @@ -1057,7 +1057,7 @@
"created": "2024-03-28T09:18:58.835Z",
"modified": "2024-03-28T09:21:22.628Z",
"identity_class": "individual",
"name": "IndA bis",
"name": "Indivual A",
"x_opencti_aliases": [
"IndA",
"IndA ter"
Expand Down

0 comments on commit b46de27

Please sign in to comment.