snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
99
apps/meteor/tests/end-to-end/api/licenses.ts
Normal file
99
apps/meteor/tests/end-to-end/api/licenses.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import type { Credentials } from '@rocket.chat/api-client';
|
||||
import type { IUser } from '@rocket.chat/core-typings';
|
||||
import { expect } from 'chai';
|
||||
import { before, describe, it, after } from 'mocha';
|
||||
|
||||
import { getCredentials, api, request, credentials } from '../../data/api-data';
|
||||
import { password } from '../../data/user';
|
||||
import type { TestUser } from '../../data/users.helper';
|
||||
import { createUser, deleteUser, login } from '../../data/users.helper';
|
||||
|
||||
describe('licenses', () => {
|
||||
let createdUser: TestUser<IUser>;
|
||||
|
||||
before((done) => getCredentials(done));
|
||||
let unauthorizedUserCredentials: Credentials;
|
||||
|
||||
before(async () => {
|
||||
createdUser = await createUser();
|
||||
unauthorizedUserCredentials = await login(createdUser.username, password);
|
||||
});
|
||||
|
||||
after(() => deleteUser(createdUser));
|
||||
|
||||
describe('[/licenses.add]', () => {
|
||||
it('should fail if not logged in', async () => {
|
||||
const res = await request
|
||||
.post(api('licenses.add'))
|
||||
.send({
|
||||
license: '',
|
||||
})
|
||||
.expect('Content-Type', 'application/json')
|
||||
.expect(401);
|
||||
|
||||
expect(res.body).to.have.property('status', 'error');
|
||||
expect(res.body).to.have.property('message');
|
||||
});
|
||||
|
||||
it('should fail if user is unauthorized', async () => {
|
||||
const res = await request
|
||||
.post(api('licenses.add'))
|
||||
.set(unauthorizedUserCredentials)
|
||||
.send({
|
||||
license: '',
|
||||
})
|
||||
.expect('Content-Type', 'application/json')
|
||||
.expect(403);
|
||||
|
||||
expect(res.body).to.have.property('success', false);
|
||||
expect(res.body).to.have.property('error', 'User does not have the permissions required for this action [error-unauthorized]');
|
||||
});
|
||||
|
||||
it('should fail if license is invalid', async () => {
|
||||
const res = await request
|
||||
.post(api('licenses.add'))
|
||||
.set(credentials)
|
||||
.send({
|
||||
license: '',
|
||||
})
|
||||
.expect('Content-Type', 'application/json')
|
||||
.expect(400);
|
||||
|
||||
expect(res.body).to.have.property('success', false);
|
||||
expect(res.body).to.have.property('error');
|
||||
});
|
||||
});
|
||||
|
||||
describe('[/licenses.info]', () => {
|
||||
it('should fail if not logged in', async () => {
|
||||
const res = await request.get(api('licenses.info')).expect('Content-Type', 'application/json').expect(401);
|
||||
|
||||
expect(res.body).to.have.property('status', 'error');
|
||||
expect(res.body).to.have.property('message');
|
||||
});
|
||||
|
||||
it('should return limited information if user is unauthorized', async () => {
|
||||
const res = await request
|
||||
.get(api('licenses.info'))
|
||||
.set(unauthorizedUserCredentials)
|
||||
.expect('Content-Type', 'application/json')
|
||||
.expect(200);
|
||||
|
||||
expect(res.body).to.have.property('success', true);
|
||||
expect(res.body).to.have.property('license').and.to.be.an('object');
|
||||
expect(res.body.license).to.not.have.property('license');
|
||||
expect(res.body.license).to.have.property('tags').and.to.be.an('array');
|
||||
});
|
||||
|
||||
it('should return unrestricted info if user is logged in and is authorized', async () => {
|
||||
const res = await request.get(api('licenses.info')).set(credentials).expect(200);
|
||||
|
||||
expect(res.body).to.have.property('success', true);
|
||||
expect(res.body).to.have.property('license').and.to.be.an('object');
|
||||
if (process.env.IS_EE) {
|
||||
expect(res.body.license).to.have.property('license').and.to.be.an('object');
|
||||
}
|
||||
expect(res.body.license).to.have.property('tags').and.to.be.an('array');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user