3 const assert = require('assert');
4 const proxyquireNoCallThru = require('proxyquire').noCallThru();
5 const fixtureLoader = require('gitter-web-test-utils/lib/test-fixtures');
6 const TestError = require('gitter-web-test-utils/lib/test-error');
8 describe.skip('gitlab-user-service #flakey #slow #gitlab', function() {
9 fixtureLoader.ensureIntegrationEnvironment('GITLAB_USER_TOKEN');
15 let oauthToken = null;
16 let GitLabUserService;
19 GitLabUserService = proxyquireNoCallThru('../lib/user-service', {
20 './get-gitlab-access-token-from-user': function() {
21 return Promise.resolve(oauthToken);
31 oauthToken = fixtureLoader.GITLAB_USER_TOKEN;
34 it('should fetch user by GitLab user ID', async () => {
35 const glGroupService = new GitLabUserService(FAKE_USER);
36 const user = await glGroupService.getUserById(2619770);
37 assert.strictEqual(user.username, 'gitter-integration-tests');
40 it('should fetch user by GitLab username', async () => {
41 const glGroupService = new GitLabUserService(FAKE_USER);
42 const user = await glGroupService.getUserByUsername('gitter-integration-tests');
43 assert.strictEqual(user.username, 'gitter-integration-tests');
46 it('should throw error when unable to find user', async () => {
47 const glGroupService = new GitLabUserService(FAKE_USER);
50 await glGroupService.getUserByUsername('!!non-existant-user!!');
53 'we expect an error to be thrown instead of an actual user from getUserByUsername'
57 if (err instanceof TestError) {