Commit 52ad0aa1 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 77d48545 fe76bb29
......@@ -5,6 +5,7 @@ import axios from './lib/utils/axios_utils';
const Api = {
groupsPath: '/api/:version/groups.json',
groupPath: '/api/:version/groups/:id',
groupMembersPath: '/api/:version/groups/:id/members',
subgroupsPath: '/api/:version/groups/:id/subgroups',
namespacesPath: '/api/:version/namespaces.json',
groupProjectsPath: '/api/:version/groups/:id/projects.json',
......@@ -43,6 +44,12 @@ const Api = {
});
},
groupMembers(id) {
const url = Api.buildUrl(this.groupMembersPath).replace(':id', encodeURIComponent(id));
return axios.get(url);
},
// Return groups list. Filtered by query
groups(query, options, callback = $.noop) {
const url = Api.buildUrl(Api.groupsPath);
......
......@@ -49,6 +49,22 @@ describe('Api', () => {
});
});
describe('groupMembers', () => {
it('fetches group members', done => {
const groupId = '54321';
const expectedUrl = `${dummyUrlRoot}/api/${dummyApiVersion}/groups/${groupId}/members`;
const expectedData = [{ id: 7 }];
mock.onGet(expectedUrl).reply(200, expectedData);
Api.groupMembers(groupId)
.then(({ data }) => {
expect(data).toEqual(expectedData);
})
.then(done)
.catch(done.fail);
});
});
describe('groups', () => {
it('fetches groups', done => {
const query = 'dummy query';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment