forked from defensestation/osquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_test.go
More file actions
38 lines (36 loc) · 823 Bytes
/
script_test.go
File metadata and controls
38 lines (36 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package osquery
import "testing"
func TestScriptField(t *testing.T) {
runMapTests(t, []mapTest{
{
"script with source",
Script("my_script").
Source("doc['my_field'].value * params.factor").
Params(ScriptParams{"factor": 2}).
Lang("painless"),
map[string]interface{}{
"script": map[string]interface{}{
"source": "doc['my_field'].value * params.factor",
"params": map[string]interface{}{
"factor": 2,
},
"lang": "painless",
},
},
},
{
"script with all fields",
Script("my_script").
ID("my_id").
Params(ScriptParams{"factor": 2}).
Lang("painless"),
map[string]interface{}{
"script": map[string]interface{}{
"id": "my_id",
"params": map[string]interface{}{"factor": 2},
"lang": "painless",
},
},
},
})
}