3 process.env.DISABLE_MATRIX_BRIDGE = '1';
4 process.env.DISABLE_API_LISTEN = '1';
5 process.env.DISABLE_API_WEB_LISTEN = '1';
6 process.env.TEST_EXPORT_RATE_LIMIT = 100;
8 const fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
9 const assert = require('assert');
10 const request = require('supertest');
12 const app = require('../../../server/web');
14 describe('room-export-resource', function() {
15 fixtureLoader.ensureIntegrationEnvironment('#oauthTokens');
18 if (this._skipFixtureSetup) return;
21 var fixture = fixtureLoader.setup({
23 accessToken: 'web-internal'
26 accessToken: 'web-internal'
31 extraAdmins: ['user1']
36 it('GET /api_web/export/rooms/:room_id/messages.ndjson as admin works', function() {
38 .get(`/api_web/export/rooms/${fixture.troupe1.id}/messages.ndjson`)
39 .set('Accept', 'application/x-ndjson,application/json')
40 .set('Authorization', `Bearer ${fixture.user1.accessToken}`)
44 it('GET /api_web/export/rooms/:room_id/messages.ndjson as not admin is forbidden', function() {
46 .get(`/api_web/export/rooms/${fixture.troupe1.id}/messages.ndjson`)
47 .set('Accept', 'application/x-ndjson,application/json')
48 .set('Authorization', `Bearer ${fixture.userNoExport1.accessToken}`)
50 .then(function(result) {
51 assert.deepEqual(result.body, { error: 'Forbidden' });