-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmain_test.go
35 lines (32 loc) · 823 Bytes
/
main_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
package main
import (
"strings"
"testing"
)
func TestConfig(t *testing.T) {
for key, c := range configByHost {
if key == "android.googlesource.com" {
continue
}
if !strings.Contains(c.Endpoint.AuthURL, key) {
t.Errorf("bad auth url for key %s: %s", key, c.Endpoint.AuthURL)
}
if !strings.Contains(c.Endpoint.TokenURL, key) {
t.Errorf("bad token url for key %s: %s", key, c.Endpoint.TokenURL)
}
if c.Endpoint.DeviceAuthURL != "" && !strings.Contains(c.Endpoint.DeviceAuthURL, key) {
t.Errorf("bad device auth url for key %s: %s", key, c.Endpoint.DeviceAuthURL)
}
}
}
func FuzzParse(f *testing.F) {
f.Add("key=value")
f.Add("key=")
f.Add("==")
f.Add("\n\n\n")
f.Add("key=value=long")
f.Add("wwwauth[]=value1\nwwwauth[]=value2")
f.Fuzz(func(_ *testing.T, s string) {
parse(s)
})
}