mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
ca435eb244
This is the feature branch for the [queued scripts](https://github.com/fleetdm/fleet/issues/15529) story. --------- Co-authored-by: Jahziel Villasana-Espinoza <jahziel@fleetdm.com> Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com> Co-authored-by: Sarah Gillespie <73313222+gillespi314@users.noreply.github.com> Co-authored-by: Roberto Dip <dip.jesusr@gmail.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import { IScriptResultResponse } from "services/entities/scripts";
|
|
import { IScript, IHostScript } from "interfaces/script";
|
|
|
|
const DEFAULT_SCRIPT_MOCK: IScript = {
|
|
id: 1,
|
|
team_id: null,
|
|
name: "test script",
|
|
created_at: "2020-01-01T00:00:00.000Z",
|
|
updated_at: "2020-01-01T00:00:00.000Z",
|
|
};
|
|
|
|
export const createMockScript = (overrides?: Partial<IScript>): IScript => {
|
|
return { ...DEFAULT_SCRIPT_MOCK, ...overrides };
|
|
};
|
|
|
|
const DEFAULT_SCRIPT_RESULT_MOCK: IScriptResultResponse = {
|
|
hostname: "Test Host",
|
|
host_id: 1,
|
|
execution_id: "123",
|
|
script_contents: "ls /home/*\necho 'testing'\necho 'lines'\nexit $?",
|
|
exit_code: 0,
|
|
output: "test\nlines\n",
|
|
message: "",
|
|
runtime: 0,
|
|
host_timeout: false,
|
|
script_id: 1,
|
|
};
|
|
|
|
export const createMockScriptResult = (
|
|
overrides?: Partial<IScriptResultResponse>
|
|
): IScriptResultResponse => {
|
|
return { ...DEFAULT_SCRIPT_RESULT_MOCK, ...overrides };
|
|
};
|
|
|
|
const DEFAULT_HOST_SCRIPT_MOCK: IHostScript = {
|
|
script_id: 1,
|
|
name: "test script",
|
|
last_execution: {
|
|
execution_id: "123",
|
|
executed_at: "2020-01-01T00:00:00.000Z",
|
|
status: "ran",
|
|
},
|
|
};
|
|
|
|
export const createMockHostScript = (
|
|
overrides?: Partial<IHostScript>
|
|
): IHostScript => {
|
|
return { ...DEFAULT_HOST_SCRIPT_MOCK, ...overrides };
|
|
};
|