Skip to content

Commit

Permalink
Fixing api integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spong committed Jul 1, 2020
1 parent bf55585 commit 37f7915
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@ export const updateRules = async ({
actions: actions.map(transformRuleToAlertAction),
throttle: null,
params: {
author,
buildingBlockType,
description,
ruleId: rule.params.ruleId,
falsePositives,
from,
immutable: rule.params.immutable,
query,
language,
license,
outputIndex,
savedId,
timelineId,
Expand All @@ -125,8 +128,12 @@ export const updateRules = async ({
index,
maxSignals,
riskScore,
riskScoreMapping,
ruleNameOverride,
severity,
severityMapping,
threat,
timestampOverride,
to,
type,
references,
Expand Down
9 changes: 9 additions & 0 deletions x-pack/test/detection_engine_api_integration/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export const binaryToString = (res: any, callback: any): void => {
*/
export const getSimpleRuleOutput = (ruleId = 'rule-1'): Partial<RulesSchema> => ({
actions: [],
author: [],
created_by: 'elastic',
description: 'Simple Rule Query',
enabled: true,
Expand All @@ -192,10 +193,12 @@ export const getSimpleRuleOutput = (ruleId = 'rule-1'): Partial<RulesSchema> =>
output_index: '.siem-signals-default',
max_signals: 100,
risk_score: 1,
risk_score_mapping: [],
name: 'Simple Rule Query',
query: 'user.name: root or user.name: admin',
references: [],
severity: 'high',
severity_mapping: [],
updated_by: 'elastic',
tags: [],
to: 'now',
Expand Down Expand Up @@ -307,13 +310,15 @@ export const ruleToNdjson = (rule: Partial<CreateRulesSchema>): Buffer => {
*/
export const getComplexRule = (ruleId = 'rule-1'): Partial<RulesSchema> => ({
actions: [],
author: [],
name: 'Complex Rule Query',
description: 'Complex Rule Query',
false_positives: [
'https://www.example.com/some-article-about-a-false-positive',
'some text string about why another condition could be a false positive',
],
risk_score: 1,
risk_score_mapping: [],
rule_id: ruleId,
filters: [
{
Expand All @@ -340,6 +345,7 @@ export const getComplexRule = (ruleId = 'rule-1'): Partial<RulesSchema> => ({
to: 'now',
from: 'now-6m',
severity: 'high',
severity_mapping: [],
language: 'kuery',
type: 'query',
threat: [
Expand Down Expand Up @@ -391,6 +397,7 @@ export const getComplexRule = (ruleId = 'rule-1'): Partial<RulesSchema> => ({
*/
export const getComplexRuleOutput = (ruleId = 'rule-1'): Partial<RulesSchema> => ({
actions: [],
author: [],
created_by: 'elastic',
name: 'Complex Rule Query',
description: 'Complex Rule Query',
Expand All @@ -399,6 +406,7 @@ export const getComplexRuleOutput = (ruleId = 'rule-1'): Partial<RulesSchema> =>
'some text string about why another condition could be a false positive',
],
risk_score: 1,
risk_score_mapping: [],
rule_id: ruleId,
filters: [
{
Expand Down Expand Up @@ -426,6 +434,7 @@ export const getComplexRuleOutput = (ruleId = 'rule-1'): Partial<RulesSchema> =>
to: 'now',
from: 'now-6m',
severity: 'high',
severity_mapping: [],
language: 'kuery',
type: 'query',
threat: [
Expand Down

0 comments on commit 37f7915

Please sign in to comment.