Debian Codegraph @

creds/creds_test.go

raw symbols SCIP
1 package credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
5 "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
6 "slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/"
7 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
8 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
9
10 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
11 )
12
13 func assertCredsLinesMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/assertCredsLinesMatch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, expected []string, buf *bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#) {
14 expected = append(expected, "")
15 actual := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitAfterscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitAfter().(buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().(), "\n")
16
17 slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Sortscip-go gomod github.com/golang/go/src go1.25.0 slices/Sort().(expected)
18 slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Sortscip-go gomod github.com/golang/go/src go1.25.0 slices/Sort().(actual)
19
20 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, expected, actual)
21 }
22
23 func TestCredsBufferFormatscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredsBufferFormat().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
24 creds := make(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#)
25
26 expected := []string{"capability[]=authtype\n", "capability[]=state\n"}
27
28 buf, err := creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(true)
29 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
30 assertCredsLinesMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/assertCredsLinesMatch().(t, expected, buf)
31
32 creds["protocol"] = []string{"https"}
33 creds["host"] = []string{"example.com"}
34
35 expectedPrefix := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().(expected, "")
36 expected = append(expected, "protocol=https\n", "host=example.com\n")
37
38 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(true)
39 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
40 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().(), expectedPrefix))
41 assertCredsLinesMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/assertCredsLinesMatch().(t, expected, buf)
42
43 creds["wwwauth[]"] = []string{"Basic realm=test", "Negotiate"}
44
45 expected = append(expected, "wwwauth[]=Basic realm=test\n")
46 expected = append(expected, "wwwauth[]=Negotiate\n")
47
48 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(true)
49 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
50 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(buf.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().(), expectedPrefix))
51 assertCredsLinesMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/assertCredsLinesMatch().(t, expected, buf)
52 }
53
54 func TestCredsBufferProtectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredsBufferProtect().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
55 creds := make(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#)
56
57 // Always disallow LF characters
58 creds["protocol"] = []string{"https"}
59 creds["host"] = []string{"one.example.com\nhost=two.example.com"}
60
61 buf, err := creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(false)
62 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, err)
63 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, buf)
64
65 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(true)
66 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, err)
67 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, buf)
68
69 // Disallow CR characters unless protocol protection disabled
70 creds["host"] = []string{"one.example.com\rhost=two.example.com"}
71
72 expected := []string{
73 "capability[]=authtype\n",
74 "capability[]=state\n",
75 "protocol=https\n",
76 "host=one.example.com\rhost=two.example.com\n",
77 }
78
79 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(false)
80 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
81 assertCredsLinesMatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/assertCredsLinesMatch().(t, expected, buf)
82
83 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(true)
84 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, err)
85 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, buf)
86
87 // Always disallow null bytes
88 creds["host"] = []string{"one.example.com\x00host=two.example.com"}
89
90 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(false)
91 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, err)
92 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, buf)
93
94 buf, err = creds.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(true)
95 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Error().(t, err)
96 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, buf)
97 }
98
99 type testCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper# struct {
100 fillErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fillErr. error
101 approveErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approveErr. error
102 rejectErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#rejectErr. error
103 fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill. []Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#
104 approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve. []Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#
105 rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject. []Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#
106 }
107
108 func newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().() *testCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper# {
109 return &testCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#{
110 fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.: make([]Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, 0),
111 approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.: make([]Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, 0),
112 rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.: make([]Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, 0),
113 }
114 }
115
116 func (h *testCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#) Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#Fill().(input Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) {
117 h.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill. = append(h.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill., input)
118 return input, h.fillErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fillErr.
119 }
120
121 func (h *testCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#) Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#Approve().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error {
122 h.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve. = append(h.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve., creds)
123 return h.approveErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approveErr.
124 }
125
126 func (h *testCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#) Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#Reject().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error {
127 h.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject. = append(h.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject., creds)
128 return h.rejectErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#rejectErr.
129 }
130
131 func TestCredHelperSetNoErrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredHelperSetNoErrors().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
132 cache := NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().()
133 helper1 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
134 helper2 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
135 helpers := NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#{cache, helper1, helper2})
136 creds := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{"https"}, "host": []string{"example.com"}}
137
138 out, err := helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
139 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
140 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
141 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
142 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
143
144 // calling Fill() with empty cache
145 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
146 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
147 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
148 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
149 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
150
151 credsWithPass := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{
152 "protocol": []string{"https"},
153 "host": []string{"example.com"},
154 "username": []string{"foo"},
155 "password": []string{"bar"},
156 }
157 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(credsWithPass))
158 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
159 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
160
161 // calling Approve() again is cached
162 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(credsWithPass))
163 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
164 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
165
166 // access cache
167 for i := 0; i < 3; i++ {
168 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
169 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
170 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, credsWithPass, out)
171 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
172 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
173 }
174
175 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(creds))
176 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
177 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
178
179 // Reject() is never cached
180 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(creds))
181 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
182 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
183
184 // calling Fill() with empty cache
185 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
186 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
187 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
188 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 3, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
189 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
190 }
191
192 func TestCredHelperSetFillErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredHelperSetFillError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
193 cache := NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().()
194 helper1 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
195 helper2 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
196 helpers := NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#{cache, helper1, helper2})
197 creds := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{"https"}, "host": []string{"example.com"}}
198
199 helper1.fillErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fillErr. = errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("boom")
200 out, err := helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
201 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
202 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
203 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
204 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
205
206 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(creds))
207 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
208 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
209
210 // Fill() with cache
211 for i := 0; i < 3; i++ {
212 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
213 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
214 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
215 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
216 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
217 }
218
219 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(creds))
220 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
221 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
222
223 // Fill() with empty cache
224 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
225 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
226 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
227 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.)) // still skipped
228 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
229 }
230
231 func TestCredHelperSetApproveErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredHelperSetApproveError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
232 cache := NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().()
233 helper1 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
234 helper2 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
235 helpers := NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#{cache, helper1, helper2})
236 creds := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{"https"}, "host": []string{"example.com"}}
237
238 approveErr := errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("boom")
239 helper1.approveErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approveErr. = approveErr
240 out, err := helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
241 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
242 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
243 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
244 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
245
246 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, approveErr, helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(creds))
247 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
248 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
249
250 // cache is never set
251 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
252 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
253 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
254 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
255 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
256
257 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(creds))
258 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
259 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
260 }
261
262 func TestCredHelperSetFillAndApproveErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredHelperSetFillAndApproveError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
263 cache := NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().()
264 helper1 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
265 helper2 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
266 helpers := NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#{cache, helper1, helper2})
267 creds := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{"https"}, "host": []string{"example.com"}}
268
269 credErr := errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("boom")
270 helper1.fillErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fillErr. = credErr
271 helper2.approveErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approveErr. = credErr
272
273 out, err := helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
274 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
275 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
276 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
277 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
278
279 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, credErr, helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(creds))
280 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.)) // skipped
281 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.)) // skipped
282 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
283
284 // never approved, so cache is empty
285 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
286 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
287 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
288 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.)) // still skipped
289 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
290 }
291
292 func TestCredHelperSetRejectErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredHelperSetRejectError().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
293 cache := NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().()
294 helper1 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
295 helper2 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
296 helpers := NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#{cache, helper1, helper2})
297 creds := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{"https"}, "host": []string{"example.com"}}
298
299 rejectErr := errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("boom")
300 helper1.rejectErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#rejectErr. = rejectErr
301 out, err := helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
302 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
303 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
304 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
305 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
306
307 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(creds))
308 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
309 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
310
311 // Fill() with cache
312 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
313 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
314 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
315 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
316 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
317
318 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, rejectErr, helpers.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(creds))
319 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
320 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
321
322 // failed Reject() still clears cache
323 out, err = helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
324 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err)
325 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, creds, out)
326 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
327 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
328 }
329
330 func TestCredHelperSetAllFillErrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/TestCredHelperSetAllFillErrors().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
331 cache := NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().()
332 helper1 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
333 helper2 := newTestCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newTestCredHelper().()
334 helpers := NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#{cache, helper1, helper2})
335 creds := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{"https"}, "host": []string{"example.com"}}
336
337 helper1.fillErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fillErr. = errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("boom 1")
338 helper2.fillErrscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fillErr. = errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("boom 2")
339 out, err := helpers.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(creds)
340 if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, err) {
341 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "credential fill errors:\nboom 1\nboom 2", err.Error())
342 }
343 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, out)
344 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper1.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
345 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(helper2.fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#fill.))
346
347 err = helpers.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(creds)
348 if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, err) {
349 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "no valid credential helpers to approve", err.Error())
350 }
351 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper1.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
352 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#approve.))
353
354 err = helpers.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(creds)
355 if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotNil().(t, err) {
356 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "no valid credential helpers to reject", err.Error())
357 }
358 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper1.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
359 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 0, len(helper2.rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/testCredHelper#reject.))
360 }