зеркало из https://github.com/mozilla/fleet.git
Fixes bug for undefined ID when revoking invites (#771)
This commit is contained in:
Родитель
92d91fdebc
Коммит
f532c2fd70
|
@ -310,9 +310,9 @@ class Kolide extends Base {
|
|||
return Base.post(resetPasswordEndpoint, JSON.stringify(formData));
|
||||
}
|
||||
|
||||
revokeInvite = ({ entityID }) => {
|
||||
revokeInvite = ({ id }) => {
|
||||
const { INVITES } = endpoints;
|
||||
const endpoint = `${this.endpoint(INVITES)}/${entityID}`;
|
||||
const endpoint = `${this.endpoint(INVITES)}/${id}`;
|
||||
|
||||
return this.authenticatedDelete(endpoint);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import nock from 'nock';
|
|||
import Kolide from 'kolide';
|
||||
import helpers from 'kolide/helpers';
|
||||
import mocks from 'test/mocks';
|
||||
import { userStub } from 'test/stubs';
|
||||
|
||||
const {
|
||||
invalidForgotPasswordRequest,
|
||||
|
@ -443,11 +444,10 @@ describe('Kolide - API client', () => {
|
|||
describe('#revokeInvite', () => {
|
||||
it('calls the appropriate endpoint with the correct parameters', (done) => {
|
||||
const bearerToken = 'valid-bearer-token';
|
||||
const entityID = 1;
|
||||
const request = validRevokeInviteRequest(bearerToken, entityID);
|
||||
const request = validRevokeInviteRequest(bearerToken, userStub);
|
||||
|
||||
Kolide.setBearerToken(bearerToken);
|
||||
Kolide.revokeInvite({ entityID })
|
||||
Kolide.revokeInvite(userStub)
|
||||
.then(() => {
|
||||
expect(request.isDone()).toEqual(true);
|
||||
done();
|
||||
|
|
|
@ -276,13 +276,13 @@ export const validResetPasswordRequest = (password, token) => {
|
|||
.reply(200, validUser);
|
||||
};
|
||||
|
||||
export const validRevokeInviteRequest = (bearerToken, inviteID) => {
|
||||
export const validRevokeInviteRequest = (bearerToken, invite) => {
|
||||
return nock('http://localhost:8080', {
|
||||
reqheaders: {
|
||||
Authorization: `Bearer ${bearerToken}`,
|
||||
},
|
||||
})
|
||||
.delete(`/api/v1/kolide/invites/${inviteID}`)
|
||||
.delete(`/api/v1/kolide/invites/${invite.id}`)
|
||||
.reply(200, {});
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче