-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtokenExtracter_test.go
More file actions
76 lines (70 loc) · 1.53 KB
/
tokenExtracter_test.go
File metadata and controls
76 lines (70 loc) · 1.53 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main
import (
"fmt"
"reflect"
"testing"
)
func Test_convertToJSON(t *testing.T) {
type args struct {
data [][]byte
buffer []string
}
tests := []struct {
name string
args args
want []byte
}{
{
name: "Ensure JSON converts",
args: args{
buffer: []string{"HAHA", "HAHA"},
data: [][]byte{
[]byte("HAHAtest123HAHA"),
},
},
want: []byte(`{"test123":""}`),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := convertToJSON(tt.args.data, tt.args.buffer); !reflect.DeepEqual(got, tt.want) {
t.Errorf("convertToJSON() = %v, want %v", got, tt.want)
}
})
}
}
func Test_extractTokens(t *testing.T) {
type args struct {
input []byte
buffer []string
}
tests := []struct {
name string
args args
want [][]byte
}{
{
name: "Test extracting tokens",
args: args{
input: []byte("bfuewiowrby8arwobyuv8fo@@@testkey!!!@@@TESTKEY2!!!bt34870fb78wpbu8pf"),
buffer: []string{"@@@", "!!!"},
},
want: [][]byte{[]byte("@@@testkey!!!"), []byte("@@@TESTKEY2!!!")},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := extractTokens(tt.args.input, tt.args.buffer); !reflect.DeepEqual(got, tt.want) {
t.Errorf("extractTokens() = %v, want %v", got, tt.want)
}
})
}
}
func Test_dataBagsContents(t *testing.T) {
}
func Test_dataBagsList(t *testing.T) {
data := collectDataBagJSON("_default", "connection_strings")
// spew.Dump(data)
test := mapKeyPairs([][]byte{data}, []string{"__", "__"})
fmt.Println(test)
}