tests: Include recording access control in room preferences where needed and reorganize imports
This commit is contained in:
parent
e8421dfa72
commit
5a7185caa3
@ -1,4 +1,7 @@
|
|||||||
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
|
import { container } from '../../../../src/config';
|
||||||
|
import { MeetStorageService } from '../../../../src/services';
|
||||||
|
import { expectValidationError, expectValidStartRecordingResponse } from '../../../utils/assertion-helpers';
|
||||||
import {
|
import {
|
||||||
bulkDeleteRecordings,
|
bulkDeleteRecordings,
|
||||||
deleteAllRecordings,
|
deleteAllRecordings,
|
||||||
@ -8,12 +11,9 @@ import {
|
|||||||
stopRecording
|
stopRecording
|
||||||
} from '../../../utils/helpers';
|
} from '../../../utils/helpers';
|
||||||
import { setupMultiRecordingsTestContext } from '../../../utils/test-scenarios';
|
import { setupMultiRecordingsTestContext } from '../../../utils/test-scenarios';
|
||||||
import { expectValidationError, expectValidStartRecordingResponse } from '../../../utils/assertion-helpers';
|
|
||||||
import { container } from '../../../../src/config/dependency-injector.config';
|
|
||||||
import { MeetStorageService } from '../../../../src/services';
|
|
||||||
|
|
||||||
describe('Recording API Tests', () => {
|
describe('Recording API Tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import {
|
import {
|
||||||
deleteAllRecordings,
|
deleteAllRecordings,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
@ -9,10 +9,10 @@ import {
|
|||||||
} from '../../../utils/helpers.js';
|
} from '../../../utils/helpers.js';
|
||||||
|
|
||||||
import { errorRecordingNotFound } from '../../../../src/models/error.model.js';
|
import { errorRecordingNotFound } from '../../../../src/models/error.model.js';
|
||||||
|
import { MeetRecordingStatus } from '../../../../src/typings/ce/recording.model.js';
|
||||||
|
import { MeetRoom } from '../../../../src/typings/ce/room.js';
|
||||||
import { expectValidationError, expectValidGetRecordingResponse } from '../../../utils/assertion-helpers.js';
|
import { expectValidationError, expectValidGetRecordingResponse } from '../../../utils/assertion-helpers.js';
|
||||||
import { setupMultiRecordingsTestContext, TestContext } from '../../../utils/test-scenarios.js';
|
import { setupMultiRecordingsTestContext, TestContext } from '../../../utils/test-scenarios.js';
|
||||||
import { MeetRoom } from '../../../../src/typings/ce/room.js';
|
|
||||||
import { MeetRecordingStatus } from '../../../../src/typings/ce/recording.model.js';
|
|
||||||
|
|
||||||
describe('Recording API Tests', () => {
|
describe('Recording API Tests', () => {
|
||||||
let context: TestContext | null = null;
|
let context: TestContext | null = null;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterAll, afterEach, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
|
import { setInternalConfig } from '../../../../src/config/internal-config.js';
|
||||||
import {
|
import {
|
||||||
deleteAllRecordings,
|
deleteAllRecordings,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
@ -9,9 +10,9 @@ import {
|
|||||||
stopAllRecordings,
|
stopAllRecordings,
|
||||||
stopRecording
|
stopRecording
|
||||||
} from '../../../utils/helpers.js';
|
} from '../../../utils/helpers.js';
|
||||||
import { setInternalConfig } from '../../../../src/config/internal-config.js';
|
|
||||||
|
|
||||||
import { errorRoomNotFound } from '../../../../src/models/error.model.js';
|
import { errorRoomNotFound } from '../../../../src/models/error.model.js';
|
||||||
|
import { MeetRoom } from '../../../../src/typings/ce/room.js';
|
||||||
import {
|
import {
|
||||||
expectValidationError,
|
expectValidationError,
|
||||||
expectValidRecordingLocationHeader,
|
expectValidRecordingLocationHeader,
|
||||||
@ -19,13 +20,12 @@ import {
|
|||||||
expectValidStopRecordingResponse
|
expectValidStopRecordingResponse
|
||||||
} from '../../../utils/assertion-helpers.js';
|
} from '../../../utils/assertion-helpers.js';
|
||||||
import { setupMultiRoomTestContext, TestContext } from '../../../utils/test-scenarios.js';
|
import { setupMultiRoomTestContext, TestContext } from '../../../utils/test-scenarios.js';
|
||||||
import { MeetRoom } from '../../../../src/typings/ce/room.js';
|
|
||||||
|
|
||||||
describe('Recording API Tests', () => {
|
describe('Recording API Tests', () => {
|
||||||
let context: TestContext | null = null;
|
let context: TestContext | null = null;
|
||||||
let room: MeetRoom, moderatorCookie: string;
|
let room: MeetRoom, moderatorCookie: string;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +1,19 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterEach, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import {
|
import {
|
||||||
|
bulkDeleteRooms,
|
||||||
createRoom,
|
createRoom,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
startTestServer,
|
disconnectFakeParticipants,
|
||||||
getRoom,
|
getRoom,
|
||||||
joinFakeParticipant,
|
joinFakeParticipant,
|
||||||
disconnectFakeParticipants,
|
startTestServer
|
||||||
bulkDeleteRooms
|
|
||||||
} from '../../../utils/helpers.js';
|
} from '../../../utils/helpers.js';
|
||||||
|
|
||||||
describe('Room API Tests', () => {
|
describe('Room API Tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
// Remove all rooms created
|
// Remove all rooms created
|
||||||
await disconnectFakeParticipants();
|
await disconnectFakeParticipants();
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import request from 'supertest';
|
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
||||||
import { Express } from 'express';
|
import { Express } from 'express';
|
||||||
import { createRoom, deleteAllRooms, loginUserAsRole, startTestServer } from '../../../utils/helpers.js';
|
|
||||||
import { UserRole } from '../../../../src/typings/ce/user.js';
|
|
||||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
|
import request from 'supertest';
|
||||||
|
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||||
|
import { MeetRecordingAccess, UserRole } from '../../../../src/typings/ce/index.js';
|
||||||
import { expectValidRoom } from '../../../utils/assertion-helpers.js';
|
import { expectValidRoom } from '../../../utils/assertion-helpers.js';
|
||||||
|
import { createRoom, deleteAllRooms, loginUserAsRole, startTestServer } from '../../../utils/helpers.js';
|
||||||
|
|
||||||
const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`;
|
const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`;
|
||||||
|
|
||||||
@ -46,7 +46,10 @@ describe('Room API Tests', () => {
|
|||||||
roomIdPrefix: ' =Example Room&/ ',
|
roomIdPrefix: ' =Example Room&/ ',
|
||||||
autoDeletionDate: validAutoDeletionDate,
|
autoDeletionDate: validAutoDeletionDate,
|
||||||
preferences: {
|
preferences: {
|
||||||
recordingPreferences: { enabled: false },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: false },
|
chatPreferences: { enabled: false },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
}
|
}
|
||||||
@ -160,7 +163,10 @@ describe('Room API Tests', () => {
|
|||||||
roomIdPrefix: 'TestRoom',
|
roomIdPrefix: 'TestRoom',
|
||||||
autoDeletionDate: validAutoDeletionDate,
|
autoDeletionDate: validAutoDeletionDate,
|
||||||
preferences: {
|
preferences: {
|
||||||
recordingPreferences: { enabled: 'yes' }, // invalid boolean
|
recordingPreferences: {
|
||||||
|
enabled: 'yes', // invalid boolean
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,21 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterEach, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
|
import ms from 'ms';
|
||||||
|
import { expectValidRoom } from '../../../utils/assertion-helpers.js';
|
||||||
import {
|
import {
|
||||||
createRoom,
|
createRoom,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
startTestServer,
|
|
||||||
getRoom,
|
|
||||||
deleteRoom,
|
deleteRoom,
|
||||||
|
disconnectFakeParticipants,
|
||||||
|
getRoom,
|
||||||
joinFakeParticipant,
|
joinFakeParticipant,
|
||||||
disconnectFakeParticipants
|
startTestServer
|
||||||
} from '../../../utils/helpers.js';
|
} from '../../../utils/helpers.js';
|
||||||
import ms from 'ms';
|
|
||||||
import { expectValidRoom } from '../../../utils/assertion-helpers.js';
|
|
||||||
|
|
||||||
describe('Room API Tests', () => {
|
describe('Room API Tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
// Remove all rooms created
|
// Remove all rooms created
|
||||||
await disconnectFakeParticipants();
|
await disconnectFakeParticipants();
|
||||||
|
|||||||
@ -1,30 +1,26 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterEach, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
|
import ms from 'ms';
|
||||||
|
import { setInternalConfig } from '../../../../src/config/internal-config.js';
|
||||||
import {
|
import {
|
||||||
createRoom,
|
createRoom,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
startTestServer,
|
disconnectFakeParticipants,
|
||||||
getRoom,
|
getRoom,
|
||||||
sleep,
|
getRooms,
|
||||||
joinFakeParticipant,
|
joinFakeParticipant,
|
||||||
runRoomGarbageCollector,
|
runRoomGarbageCollector,
|
||||||
disconnectFakeParticipants,
|
sleep,
|
||||||
getRooms
|
startTestServer
|
||||||
} from '../../../utils/helpers.js';
|
} from '../../../utils/helpers.js';
|
||||||
import ms from 'ms';
|
|
||||||
import { setInternalConfig } from '../../../../src/config/internal-config.js';
|
|
||||||
|
|
||||||
describe('Room Garbage Collector Tests', () => {
|
describe('Room Garbage Collector Tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
setInternalConfig({
|
setInternalConfig({
|
||||||
MIN_FUTURE_TIME_FOR_ROOM_AUTODELETION_DATE: '0s'
|
MIN_FUTURE_TIME_FOR_ROOM_AUTODELETION_DATE: '0s'
|
||||||
});
|
});
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
// Remove all rooms created
|
// Remove all rooms created
|
||||||
await deleteAllRooms();
|
await deleteAllRooms();
|
||||||
|
|||||||
@ -1,20 +1,19 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterEach, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { createRoom, deleteAllRooms, startTestServer, getRoom } from '../../../utils/helpers.js';
|
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
|
import { MeetRecordingAccess } from '../../../../src/typings/ce/index.js';
|
||||||
import {
|
import {
|
||||||
expectSuccessRoomResponse,
|
expectSuccessRoomResponse,
|
||||||
expectValidationError,
|
expectValidationError,
|
||||||
expectValidRoom,
|
expectValidRoom,
|
||||||
expectValidRoomWithFields
|
expectValidRoomWithFields
|
||||||
} from '../../../utils/assertion-helpers.js';
|
} from '../../../utils/assertion-helpers.js';
|
||||||
|
import { createRoom, deleteAllRooms, getRoom, startTestServer } from '../../../utils/helpers.js';
|
||||||
|
|
||||||
describe('Room API Tests', () => {
|
describe('Room API Tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
// Remove all rooms created
|
// Remove all rooms created
|
||||||
await deleteAllRooms();
|
await deleteAllRooms();
|
||||||
@ -36,7 +35,10 @@ describe('Room API Tests', () => {
|
|||||||
const payload = {
|
const payload = {
|
||||||
roomIdPrefix: 'custom-prefs',
|
roomIdPrefix: 'custom-prefs',
|
||||||
preferences: {
|
preferences: {
|
||||||
recordingPreferences: { enabled: true },
|
recordingPreferences: {
|
||||||
|
enabled: true,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: false }
|
virtualBackgroundPreferences: { enabled: false }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,21 @@
|
|||||||
import { describe, it, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterEach, beforeAll, describe, it } from '@jest/globals';
|
||||||
import { createRoom, deleteAllRooms, getRooms, startTestServer, } from '../../../utils/helpers.js';
|
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
|
import { MeetRoom } from '../../../../src/typings/ce/index.js';
|
||||||
import {
|
import {
|
||||||
expectSuccessRoomsResponse,
|
expectSuccessRoomsResponse,
|
||||||
expectValidationError,
|
expectValidationError,
|
||||||
expectValidRoom,
|
expectValidRoom,
|
||||||
expectValidRoomWithFields
|
expectValidRoomWithFields
|
||||||
} from '../../../utils/assertion-helpers.js';
|
} from '../../../utils/assertion-helpers.js';
|
||||||
import { MeetRoom } from '../../../../src/typings/ce/room.js';
|
import { createRoom, deleteAllRooms, getRooms, startTestServer } from '../../../utils/helpers.js';
|
||||||
|
|
||||||
describe('Room API Tests', () => {
|
describe('Room API Tests', () => {
|
||||||
const validAutoDeletionDate = Date.now() + ms('2h');
|
const validAutoDeletionDate = Date.now() + ms('2h');
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
// Remove all rooms created
|
// Remove all rooms created
|
||||||
await deleteAllRooms();
|
await deleteAllRooms();
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
import { describe, it, expect, beforeAll, afterAll, afterEach } from '@jest/globals';
|
import { afterEach, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { createRoom, deleteAllRooms, startTestServer, getRoom, updateRoomPreferences } from '../../../utils/helpers.js';
|
import { MeetRecordingAccess } from '../../../../src/typings/ce/index.js';
|
||||||
|
import { createRoom, deleteAllRooms, getRoom, startTestServer, updateRoomPreferences } from '../../../utils/helpers.js';
|
||||||
|
|
||||||
describe('Room API Tests', () => {
|
describe('Room API Tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
startTestServer();
|
startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
// Remove all rooms created
|
// Remove all rooms created
|
||||||
await deleteAllRooms();
|
await deleteAllRooms();
|
||||||
@ -18,7 +17,10 @@ describe('Room API Tests', () => {
|
|||||||
const createdRoom = await createRoom({
|
const createdRoom = await createRoom({
|
||||||
roomIdPrefix: 'update-test',
|
roomIdPrefix: 'update-test',
|
||||||
preferences: {
|
preferences: {
|
||||||
recordingPreferences: { enabled: true },
|
recordingPreferences: {
|
||||||
|
enabled: true,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
}
|
}
|
||||||
@ -26,7 +28,10 @@ describe('Room API Tests', () => {
|
|||||||
|
|
||||||
// Update the room preferences
|
// Update the room preferences
|
||||||
const updatedPreferences = {
|
const updatedPreferences = {
|
||||||
recordingPreferences: { enabled: false },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN
|
||||||
|
},
|
||||||
chatPreferences: { enabled: false },
|
chatPreferences: { enabled: false },
|
||||||
virtualBackgroundPreferences: { enabled: false }
|
virtualBackgroundPreferences: { enabled: false }
|
||||||
};
|
};
|
||||||
@ -49,7 +54,10 @@ describe('Room API Tests', () => {
|
|||||||
const createdRoom = await createRoom({
|
const createdRoom = await createRoom({
|
||||||
roomIdPrefix: 'partial-update',
|
roomIdPrefix: 'partial-update',
|
||||||
preferences: {
|
preferences: {
|
||||||
recordingPreferences: { enabled: true },
|
recordingPreferences: {
|
||||||
|
enabled: true,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
}
|
}
|
||||||
@ -57,7 +65,10 @@ describe('Room API Tests', () => {
|
|||||||
|
|
||||||
// Update only one preference
|
// Update only one preference
|
||||||
const partialPreferences = {
|
const partialPreferences = {
|
||||||
recordingPreferences: { enabled: false },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
};
|
};
|
||||||
@ -83,7 +94,10 @@ describe('Room API Tests', () => {
|
|||||||
|
|
||||||
// Invalid preferences (missing required fields)
|
// Invalid preferences (missing required fields)
|
||||||
const invalidPreferences = {
|
const invalidPreferences = {
|
||||||
recordingPreferences: { enabled: false },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
// Missing chatPreferences
|
// Missing chatPreferences
|
||||||
virtualBackgroundPreferences: { enabled: false }
|
virtualBackgroundPreferences: { enabled: false }
|
||||||
};
|
};
|
||||||
@ -102,7 +116,10 @@ describe('Room API Tests', () => {
|
|||||||
|
|
||||||
// Invalid preferences (wrong types)
|
// Invalid preferences (wrong types)
|
||||||
const invalidPreferences = {
|
const invalidPreferences = {
|
||||||
recordingPreferences: { enabled: 'true' }, // String instead of boolean
|
recordingPreferences: {
|
||||||
|
enabled: 'true', // String instead of boolean
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: false },
|
chatPreferences: { enabled: false },
|
||||||
virtualBackgroundPreferences: { enabled: false }
|
virtualBackgroundPreferences: { enabled: false }
|
||||||
};
|
};
|
||||||
@ -131,7 +148,10 @@ describe('Room API Tests', () => {
|
|||||||
const invalidRoomId = '!@#$%^&*()';
|
const invalidRoomId = '!@#$%^&*()';
|
||||||
|
|
||||||
const preferences = {
|
const preferences = {
|
||||||
recordingPreferences: { enabled: false },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: false },
|
chatPreferences: { enabled: false },
|
||||||
virtualBackgroundPreferences: { enabled: false }
|
virtualBackgroundPreferences: { enabled: false }
|
||||||
};
|
};
|
||||||
@ -146,7 +166,10 @@ describe('Room API Tests', () => {
|
|||||||
const nonExistentRoomId = 'non-existent-room';
|
const nonExistentRoomId = 'non-existent-room';
|
||||||
|
|
||||||
const preferences = {
|
const preferences = {
|
||||||
recordingPreferences: { enabled: false },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: false },
|
chatPreferences: { enabled: false },
|
||||||
virtualBackgroundPreferences: { enabled: false }
|
virtualBackgroundPreferences: { enabled: false }
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,21 +1,19 @@
|
|||||||
import request from 'supertest';
|
import { beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
||||||
import { Express } from 'express';
|
import { Express } from 'express';
|
||||||
import { loginUserAsRole, startTestServer } from '../../../utils/helpers.js';
|
import request from 'supertest';
|
||||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||||
import { UserRole } from '../../../../src/typings/ce/index.js';
|
import { UserRole } from '../../../../src/typings/ce/index.js';
|
||||||
|
import { loginUserAsRole, startTestServer } from '../../../utils/helpers.js';
|
||||||
|
|
||||||
const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`;
|
const AUTH_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`;
|
||||||
|
|
||||||
describe('Authentication API Tests', () => {
|
describe('Authentication API Tests', () => {
|
||||||
let app: Express;
|
let app: Express;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
app = startTestServer();
|
app = startTestServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => {});
|
|
||||||
|
|
||||||
describe('Login Tests', () => {
|
describe('Login Tests', () => {
|
||||||
it('should successfully login with valid credentials', async () => {
|
it('should successfully login with valid credentials', async () => {
|
||||||
const response = await request(app)
|
const response = await request(app)
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
import request from 'supertest';
|
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
||||||
import { Express } from 'express';
|
import { Express } from 'express';
|
||||||
import { createRoom, generateParticipantToken, startTestServer } from '../../../utils/helpers.js';
|
import request from 'supertest';
|
||||||
import { UserRole } from '../../../../src/typings/ce/index.js';
|
|
||||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||||
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
||||||
import { deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js';
|
import { UserRole } from '../../../../src/typings/ce/index.js';
|
||||||
|
import {
|
||||||
|
createRoom,
|
||||||
|
deleteAllRooms,
|
||||||
|
generateParticipantToken,
|
||||||
|
loginUserAsRole,
|
||||||
|
startTestServer
|
||||||
|
} from '../../../utils/helpers.js';
|
||||||
|
|
||||||
const MEETINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings`;
|
const MEETINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings`;
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
import request from 'supertest';
|
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
||||||
import { Express } from 'express';
|
import { Express } from 'express';
|
||||||
import { createRoom, startTestServer } from '../../../utils/helpers.js';
|
import request from 'supertest';
|
||||||
import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js';
|
|
||||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||||
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
||||||
import { changeSecurityPreferences, deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js';
|
import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js';
|
||||||
|
import {
|
||||||
|
changeSecurityPreferences,
|
||||||
|
createRoom,
|
||||||
|
deleteAllRooms,
|
||||||
|
loginUserAsRole,
|
||||||
|
startTestServer
|
||||||
|
} from '../../../utils/helpers.js';
|
||||||
|
|
||||||
const PARTICIPANTS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/participants`;
|
const PARTICIPANTS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/participants`;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
import request from 'supertest';
|
import { afterAll, beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
|
|
||||||
import { Express } from 'express';
|
import { Express } from 'express';
|
||||||
|
import request from 'supertest';
|
||||||
|
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||||
|
import { MEET_API_KEY } from '../../../../src/environment.js';
|
||||||
|
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
||||||
|
import { UserRole } from '../../../../src/typings/ce/index.js';
|
||||||
import {
|
import {
|
||||||
createRoom,
|
createRoom,
|
||||||
deleteAllRooms,
|
deleteAllRooms,
|
||||||
@ -8,10 +12,6 @@ import {
|
|||||||
loginUserAsRole,
|
loginUserAsRole,
|
||||||
startTestServer
|
startTestServer
|
||||||
} from '../../../utils/helpers.js';
|
} from '../../../utils/helpers.js';
|
||||||
import { MEET_API_KEY } from '../../../../src/environment.js';
|
|
||||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
|
||||||
import { UserRole } from '../../../../src/typings/ce/index.js';
|
|
||||||
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
|
||||||
|
|
||||||
const RECORDINGS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`;
|
const RECORDINGS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`;
|
||||||
const INTERNAL_RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`;
|
const INTERNAL_RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`;
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
import request from 'supertest';
|
import { afterAll, beforeAll, beforeEach, describe, expect, it } from '@jest/globals';
|
||||||
import { describe, it, expect, beforeAll, beforeEach, afterAll } from '@jest/globals';
|
|
||||||
import { Express } from 'express';
|
import { Express } from 'express';
|
||||||
import { createRoom, generateParticipantToken, startTestServer } from '../../../utils/helpers.js';
|
import request from 'supertest';
|
||||||
import { AuthMode, UserRole } from '../../../../src/typings/ce/index.js';
|
|
||||||
import { MEET_API_KEY } from '../../../../src/environment.js';
|
|
||||||
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
import INTERNAL_CONFIG from '../../../../src/config/internal-config.js';
|
||||||
|
import { MEET_API_KEY } from '../../../../src/environment.js';
|
||||||
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
import { MeetRoomHelper } from '../../../../src/helpers/room.helper.js';
|
||||||
import { changeSecurityPreferences, deleteAllRooms, loginUserAsRole } from '../../../utils/helpers.js';
|
import { AuthMode, MeetRecordingAccess, UserRole } from '../../../../src/typings/ce/index.js';
|
||||||
|
import {
|
||||||
|
changeSecurityPreferences,
|
||||||
|
createRoom,
|
||||||
|
deleteAllRooms,
|
||||||
|
generateParticipantToken,
|
||||||
|
loginUserAsRole,
|
||||||
|
startTestServer
|
||||||
|
} from '../../../utils/helpers.js';
|
||||||
|
|
||||||
const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`;
|
const ROOMS_PATH = `${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`;
|
||||||
const INTERNAL_ROOMS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`;
|
const INTERNAL_ROOMS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`;
|
||||||
@ -38,7 +44,7 @@ describe('Room API Security Tests', () => {
|
|||||||
.post(ROOMS_PATH)
|
.post(ROOMS_PATH)
|
||||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY)
|
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY)
|
||||||
.send({});
|
.send({});
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(201);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should succeed when users cannot create rooms, and user is authenticated as admin', async () => {
|
it('should succeed when users cannot create rooms, and user is authenticated as admin', async () => {
|
||||||
@ -47,7 +53,7 @@ describe('Room API Security Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const response = await request(app).post(ROOMS_PATH).set('Cookie', adminCookie).send({});
|
const response = await request(app).post(ROOMS_PATH).set('Cookie', adminCookie).send({});
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(201);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail when users cannot create rooms, and user is authenticated as user', async () => {
|
it('should fail when users cannot create rooms, and user is authenticated as user', async () => {
|
||||||
@ -75,7 +81,7 @@ describe('Room API Security Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const response = await request(app).post(ROOMS_PATH).send({});
|
const response = await request(app).post(ROOMS_PATH).send({});
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(201);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should succeed when users can create rooms and auth is required, and user is authenticated', async () => {
|
it('should succeed when users can create rooms and auth is required, and user is authenticated', async () => {
|
||||||
@ -85,7 +91,7 @@ describe('Room API Security Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const response = await request(app).post(ROOMS_PATH).set('Cookie', userCookie).send({});
|
const response = await request(app).post(ROOMS_PATH).set('Cookie', userCookie).send({});
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(201);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail when users can create rooms and auth is required, and user is not authenticated', async () => {
|
it('should fail when users can create rooms and auth is required, and user is not authenticated', async () => {
|
||||||
@ -299,7 +305,10 @@ describe('Room API Security Tests', () => {
|
|||||||
|
|
||||||
describe('Update Room Preferences Tests', () => {
|
describe('Update Room Preferences Tests', () => {
|
||||||
const roomPreferences = {
|
const roomPreferences = {
|
||||||
recordingPreferences: { enabled: true },
|
recordingPreferences: {
|
||||||
|
enabled: false,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { expect } from '@jest/globals';
|
import { expect } from '@jest/globals';
|
||||||
import INTERNAL_CONFIG from '../../src/config/internal-config';
|
import INTERNAL_CONFIG from '../../src/config/internal-config';
|
||||||
import { MeetRecordingStatus, MeetRoom, MeetRoomPreferences } from '../../src/typings/ce';
|
import { MeetRecordingAccess, MeetRecordingStatus, MeetRoom, MeetRoomPreferences } from '../../src/typings/ce';
|
||||||
|
|
||||||
const RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`;
|
const RECORDINGS_PATH = `${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`;
|
||||||
|
|
||||||
const expectErrorResponse = (
|
const expectErrorResponse = (
|
||||||
@ -111,7 +112,10 @@ export const expectValidRoom = (
|
|||||||
expect(room.preferences).toEqual(preferences);
|
expect(room.preferences).toEqual(preferences);
|
||||||
} else {
|
} else {
|
||||||
expect(room.preferences).toEqual({
|
expect(room.preferences).toEqual({
|
||||||
recordingPreferences: { enabled: true },
|
recordingPreferences: {
|
||||||
|
enabled: true,
|
||||||
|
allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_PUBLISHER
|
||||||
|
},
|
||||||
chatPreferences: { enabled: true },
|
chatPreferences: { enabled: true },
|
||||||
virtualBackgroundPreferences: { enabled: true }
|
virtualBackgroundPreferences: { enabled: true }
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { container } from '../../src/config/dependency-injector.config';
|
import { container } from '../../src/config/index.js';
|
||||||
import { SystemEventType } from '../../src/models/system-event.model.js';
|
import { SystemEventType } from '../../src/models/system-event.model.js';
|
||||||
import { SystemEventService } from '../../src/services/index.js';
|
import { SystemEventService } from '../../src/services/index.js';
|
||||||
|
|
||||||
|
|||||||
@ -1,25 +1,24 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import request, { Response } from 'supertest';
|
|
||||||
import { Express } from 'express';
|
|
||||||
import { createApp, registerDependencies } from '../../src/server.js';
|
|
||||||
import {
|
|
||||||
MEET_API_KEY,
|
|
||||||
MEET_USER,
|
|
||||||
MEET_SECRET,
|
|
||||||
MEET_ADMIN_USER,
|
|
||||||
MEET_ADMIN_SECRET,
|
|
||||||
LIVEKIT_API_SECRET,
|
|
||||||
LIVEKIT_API_KEY,
|
|
||||||
MEET_NAME_ID
|
|
||||||
} from '../../src/environment.js';
|
|
||||||
import { AuthMode, AuthType, MeetRoom, UserRole, MeetRoomOptions } from '../../src/typings/ce/index.js';
|
|
||||||
import { expect } from '@jest/globals';
|
import { expect } from '@jest/globals';
|
||||||
import INTERNAL_CONFIG from '../../src/config/internal-config.js';
|
|
||||||
import { ChildProcess, execSync, spawn } from 'child_process';
|
import { ChildProcess, execSync, spawn } from 'child_process';
|
||||||
import { container } from '../../src/config/dependency-injector.config.js';
|
import { Express } from 'express';
|
||||||
import { RoomService } from '../../src/services/room.service.js';
|
|
||||||
import { RecordingService } from '../../src/services/recording.service.js';
|
|
||||||
import ms, { StringValue } from 'ms';
|
import ms, { StringValue } from 'ms';
|
||||||
|
import request, { Response } from 'supertest';
|
||||||
|
import { container } from '../../src/config/index.js';
|
||||||
|
import INTERNAL_CONFIG from '../../src/config/internal-config.js';
|
||||||
|
import {
|
||||||
|
LIVEKIT_API_KEY,
|
||||||
|
LIVEKIT_API_SECRET,
|
||||||
|
MEET_ADMIN_SECRET,
|
||||||
|
MEET_ADMIN_USER,
|
||||||
|
MEET_API_KEY,
|
||||||
|
MEET_NAME_ID,
|
||||||
|
MEET_SECRET,
|
||||||
|
MEET_USER
|
||||||
|
} from '../../src/environment.js';
|
||||||
|
import { createApp, registerDependencies } from '../../src/server.js';
|
||||||
|
import { RecordingService, RoomService } from '../../src/services/index.js';
|
||||||
|
import { AuthMode, AuthType, MeetRoom, MeetRoomOptions, UserRole } from '../../src/typings/ce/index.js';
|
||||||
|
|
||||||
const CREDENTIALS = {
|
const CREDENTIALS = {
|
||||||
user: {
|
user: {
|
||||||
@ -52,7 +51,6 @@ export const startTestServer = (): Express => {
|
|||||||
return app;
|
return app;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates global security preferences
|
* Updates global security preferences
|
||||||
*/
|
*/
|
||||||
@ -364,7 +362,7 @@ export const getRecording = async (recordingId: string) => {
|
|||||||
return await request(app)
|
return await request(app)
|
||||||
.get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`)
|
.get(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings/${recordingId}`)
|
||||||
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
.set(INTERNAL_CONFIG.API_KEY_HEADER, MEET_API_KEY);
|
||||||
}
|
};
|
||||||
|
|
||||||
export const stopAllRecordings = async (moderatorCookie: string) => {
|
export const stopAllRecordings = async (moderatorCookie: string) => {
|
||||||
if (!app) {
|
if (!app) {
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
import { MeetRoomHelper } from '../../src/helpers';
|
import { MeetRoomHelper } from '../../src/helpers';
|
||||||
import {
|
import {
|
||||||
createRoom,
|
createRoom,
|
||||||
loginUserAsRole,
|
|
||||||
generateParticipantToken,
|
generateParticipantToken,
|
||||||
joinFakeParticipant,
|
joinFakeParticipant,
|
||||||
|
loginUserAsRole,
|
||||||
|
sleep,
|
||||||
startRecording,
|
startRecording,
|
||||||
stopRecording,
|
stopRecording
|
||||||
sleep
|
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
|
|
||||||
import { MeetRoom, UserRole } from '../../src/typings/ce';
|
|
||||||
import ms, { StringValue } from 'ms';
|
import ms, { StringValue } from 'ms';
|
||||||
|
import { MeetRoom, UserRole } from '../../src/typings/ce';
|
||||||
import { expectValidStartRecordingResponse } from './assertion-helpers';
|
import { expectValidStartRecordingResponse } from './assertion-helpers';
|
||||||
|
|
||||||
export interface RoomData {
|
export interface RoomData {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user