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('user-oauth-clients-export-api', function() {
15 fixtureLoader.ensureIntegrationEnvironment('#oauthTokens');
18 if (this._skipFixtureSetup) return;
21 var fixture = fixtureLoader.setup({
23 accessToken: 'web-internal'
26 accessToken: 'web-internal'
34 oAuthClientNoExport1: {
35 ownerUser: 'userNoExport1'
39 it('GET /api_web/export/user/:user_id/oauth-clients.ndjson as same user gets data', async () => {
41 .get(`/api_web/export/user/${fixture.user1.id}/oauth-clients.ndjson`)
42 .set('Accept', 'application/x-ndjson,application/json')
43 .set('Authorization', `Bearer ${fixture.user1.accessToken}`)
45 .then(function(result) {
47 result.text.split('\n').length,
49 'includes 2 OAuth clients (extra newline at the end)'
51 assert(result.text.includes(fixture.oAuthClient1.id), 'includes oAuthClient1');
52 assert(result.text.includes(fixture.oAuthClient2.id), 'includes oAuthClient2');
54 !result.text.includes(fixture.oAuthClientNoExport1.id),
55 'does not include oAuthClientNoExport1'