fleet/frontend/test/mocks/target_mocks.js
RachelElysia e52e0747ad
Query Edit/Run: Conditional select targets dropdown (#923)
* Modify targets endpoint to  use queryId
* Conditionally render query page including queryId
* Includes conditionally renders target dropdown

Co-authored by: Sarah Gillespie @gillespi314
Test mods co-authored by: Gabriel Hernandez @ghernandez345
2021-06-04 15:13:59 -04:00

48 lines
1.1 KiB
JavaScript

import createRequestMock from "test/mocks/create_request_mock";
export default {
loadAll: {
valid: (bearerToken, query, queryId) => {
return createRequestMock({
bearerToken,
endpoint: "/api/v1/fleet/targets",
method: "post",
params: {
query,
query_id: queryId,
selected: {
hosts: [],
labels: [],
},
},
response: {
targets_count: 1234,
targets: [
{
id: 3,
label: "OS X El Capitan 10.11",
name: "osx-10.11",
platform: "darwin",
target_type: "hosts",
},
{
id: 4,
label: "Jason Meller's Macbook Pro",
name: "jmeller.local",
platform: "darwin",
target_type: "hosts",
},
{
id: 4,
label: "All Macs",
name: "macs",
count: 1234,
target_type: "labels",
},
],
},
});
},
},
};