forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit_fetcher_test.go
25 lines (21 loc) · 1.07 KB
/
git_fetcher_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
package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetCanonicalization(t *testing.T) {
vals := map[string][]string{
"user.name": []string{"Pat Doe"},
"branch.MixedCase.pushremote": []string{"Somewhere"},
"http.https://example.com/BIG-TEXT.git.extraheader": []string{"X-Foo: Bar"},
}
fetcher := GitFetcher{vals: vals}
assert.Equal(t, []string{"Somewhere"}, fetcher.GetAll("bRanch.MixedCase.pushRemote"))
assert.Equal(t, []string{"Somewhere"}, fetcher.GetAll("branch.MixedCase.pushremote"))
assert.Equal(t, []string(nil), fetcher.GetAll("branch.mixedcase.pushremote"))
assert.Equal(t, []string{"Pat Doe"}, fetcher.GetAll("user.name"))
assert.Equal(t, []string{"Pat Doe"}, fetcher.GetAll("User.Name"))
assert.Equal(t, []string{"X-Foo: Bar"}, fetcher.GetAll("http.https://example.com/BIG-TEXT.git.extraheader"))
assert.Equal(t, []string{"X-Foo: Bar"}, fetcher.GetAll("http.https://example.com/BIG-TEXT.git.extraHeader"))
assert.Equal(t, []string(nil), fetcher.GetAll("http.https://example.com/big-text.git.extraHeader"))
}