-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify_test.go
47 lines (41 loc) · 1.24 KB
/
verify_test.go
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
package cli
import (
"testing"
sthingsBase "github.com/stuttgart-things/sthingsBase"
)
func TestVerifyReadKeyValues(t *testing.T) {
logger := sthingsBase.StdOutFileLogger("/tmp/machineShop.log", "2006-01-02 15:04:05", 50, 3, 28)
tests := []struct {
templateValues []string
enableVault bool
expectedResult map[string]interface{}
}{
{
templateValues: []string{"username=admin", "password=secret"},
enableVault: false,
expectedResult: map[string]interface{}{
"username": "admin",
"password": "secret",
},
},
// {
// templateValues: []string{"key1=value1", "key2=value2"},
// enableVault: true,
// expectedResult: map[string]interface{}{
// "key1=value1": "key1=value1",
// "key2=value2": "key2=value2",
// },
// },
}
for _, test := range tests {
result := VerifyReadKeyValues(test.templateValues, logger, test.enableVault)
if len(result) != len(test.expectedResult) {
t.Errorf("Expected result length: %d, got: %d", len(test.expectedResult), len(result))
}
for key, expectedValue := range test.expectedResult {
if value, exists := result[key]; !exists || value != expectedValue {
t.Errorf("For key '%s', expected value: '%v', got: '%v'", key, expectedValue, value)
}
}
}
}