-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient_test.go
More file actions
47 lines (43 loc) · 754 Bytes
/
Copy pathclient_test.go
File metadata and controls
47 lines (43 loc) · 754 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
39
40
41
42
43
44
45
46
47
package fio
import (
"net/url"
"testing"
"github.com/stretchr/testify/require"
)
var (
sanitizeURLCases = []struct {
token string
original string
want string
}{
{
token: "",
original: "/dsa",
want: "/dsa",
},
{
token: "xx",
original: "/dsa",
want: "/dsa",
},
{
token: "ds",
original: "/dsa",
want: "/REDACTEDa",
},
{
token: "ds",
original: "/dsads",
want: "/REDACTEDaREDACTED",
},
}
)
func TestSanitizeURL(t *testing.T) {
for _, c := range sanitizeURLCases {
t.Run(c.token+c.original+c.want, func(t *testing.T) {
urlOrig := &url.URL{Path: c.original}
urlGot := SanitizeURL(c.token, urlOrig)
require.Equal(t, c.want, urlGot.Path)
})
}
}