File: git_fetcher_test.go

package info (click to toggle)
git-lfs 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,808 kB
  • sloc: sh: 21,256; makefile: 507; ruby: 417
file content (25 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download | duplicates (3)
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"))
}