-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreflection_utils_test.go
44 lines (34 loc) · 1.29 KB
/
reflection_utils_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
package confy
import (
"reflect"
"testing"
)
type testTags struct {
Notification struct {
SMTP struct {
Enabled bool `confy:"enabled" confy_description:"Enable or disable sending notifications via SMTP"`
Host string `confy:"host" confy_description:"Host domain/ip"`
Port int `confy:"port" confy_description:"Port"`
Username string `confy:"username" confy_description:"Mailing username"`
Password string `confy:"password;sensitive" confy_description:"Mailing password"`
FromEmail string `confy:"from" confy_description:"The sending email address"`
}
Webhooks struct {
Enabled bool `confy:"enabled" confy_description:"Enable or disable sending notifications via webhooks"`
SafeDomains []string `confy:"safe_domains" confy_description:"List of domains that are safe to send to, defaults to [discord.com, slack.com]"`
}
Confidential bool `confy:"confidential" confy_description:"Whether to add xss vulnerablity details to notification"`
}
}
func TestResolvePath(t *testing.T) {
var c testTags
expected := []string{
"Notification",
"SMTP",
"enabled",
}
actual := resolvePath(&c, []string{"Notification", "SMTP", "Enabled"})
if !reflect.DeepEqual(expected, actual) {
t.Fatalf("resolved path incorrect, expected %v got %v", expected, actual)
}
}