| 1 | package config |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/stretchr/testify/assert" |
| 7 | ) |
| 8 | |
| 9 | func TestGetCanonicalization(t *testing.T) { |
| 10 | vals := map[string][]string{ |
| 11 | "user.name": []string{"Pat Doe"}, |
| 12 | "branch.MixedCase.pushremote": []string{"Somewhere"}, |
| 13 | "http.https://example.com/BIG-TEXT.git.extraheader": []string{"X-Foo: Bar"}, |
| 14 | } |
| 15 | |
| 16 | fetcher := GitFetcher{vals: vals} |
| 17 | assert.Equal(t, []string{"Somewhere"}, fetcher.GetAll("bRanch.MixedCase.pushRemote")) |
| 18 | assert.Equal(t, []string{"Somewhere"}, fetcher.GetAll("branch.MixedCase.pushremote")) |
| 19 | assert.Equal(t, []string(nil), fetcher.GetAll("branch.mixedcase.pushremote")) |
| 20 | assert.Equal(t, []string{"Pat Doe"}, fetcher.GetAll("user.name")) |
| 21 | assert.Equal(t, []string{"Pat Doe"}, fetcher.GetAll("User.Name")) |
| 22 | assert.Equal(t, []string{"X-Foo: Bar"}, fetcher.GetAll("http.https://example.com/BIG-TEXT.git.extraheader")) |
| 23 | assert.Equal(t, []string{"X-Foo: Bar"}, fetcher.GetAll("http.https://example.com/BIG-TEXT.git.extraHeader")) |
| 24 | assert.Equal(t, []string(nil), fetcher.GetAll("http.https://example.com/big-text.git.extraHeader")) |
| 25 | } |