fleet/frontend/test/target_mock.js
noahtalerman 7104d0312e
Fix for cannot run query for selected teams (#1037)
- Fix ability to run live query against teams
- Update unit tests to support live queries against teams
2021-06-10 11:37:25 -04:00

29 lines
482 B
JavaScript

import nock from "nock";
const defaultParams = {
query: "",
query_id: 1,
selected: {
hosts: [],
labels: [],
teams: [],
},
};
const defaultResponse = {
targets: {
hosts: [],
labels: [],
teams: [],
},
};
export default (
params = defaultParams,
response = defaultResponse,
responseStatus = 200
) => {
return nock("http://localhost:8080")
.post("/api/v1/fleet/targets", JSON.stringify(params))
.reply(responseStatus, response);
};