fleet/frontend/test/mocks/config_option_mocks.js
John Murphy d533931799 Addresses Issue where the reset button doesn't work on options page (#1447)
Closes issue #1388. The problem here is that previously, the reset button loaded a hard coded list of default options into the component state, instead of the proper behavior which is to reset the options to default values on the back end, and then load them back into the redux store. This PR adds a ResetOptions endpoint on the server, and wires up the UI so that it triggers the endpoint, then loads the default options from the backend server.
2017-03-30 18:56:11 -05:00

36 lines
802 B
JavaScript

import createRequestMock from 'test/mocks/create_request_mock';
export default {
loadAll: {
valid: (bearerToken) => {
return createRequestMock({
bearerToken,
endpoint: '/api/v1/kolide/options',
method: 'get',
response: { options: [] },
});
},
},
update: {
valid: (bearerToken, params) => {
return createRequestMock({
bearerToken,
endpoint: '/api/v1/kolide/options',
method: 'patch',
params: { options: params },
response: { options: params },
});
},
},
reset: {
valid: (bearerToken) => {
return createRequestMock({
bearerToken,
endpoint: '/api/v1/kolide/options/reset',
method: 'get',
response: { options: [] },
});
},
},
};